@metamask-previews/design-system-react-native 0.30.2-preview.9bd8bc3 → 0.30.2-preview.e22e766

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 (65) hide show
  1. package/dist/components/BottomSheet/BottomSheet.cjs +7 -12
  2. package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
  3. package/dist/components/BottomSheet/BottomSheet.d.cts +0 -1
  4. package/dist/components/BottomSheet/BottomSheet.d.cts.map +1 -1
  5. package/dist/components/BottomSheet/BottomSheet.d.mts +0 -1
  6. package/dist/components/BottomSheet/BottomSheet.d.mts.map +1 -1
  7. package/dist/components/BottomSheet/BottomSheet.mjs +7 -12
  8. package/dist/components/BottomSheet/BottomSheet.mjs.map +1 -1
  9. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs +21 -20
  10. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs.map +1 -1
  11. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.cjs +9 -16
  12. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.cjs.map +1 -1
  13. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.d.cts +7 -14
  14. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.d.cts.map +1 -1
  15. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.d.mts +7 -14
  16. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.d.mts.map +1 -1
  17. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.mjs +8 -14
  18. package/dist/components/BottomSheetDialog/BottomSheetDialog.constants.mjs.map +1 -1
  19. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts +0 -1
  20. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts.map +1 -1
  21. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts +0 -1
  22. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts.map +1 -1
  23. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs +25 -24
  24. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs.map +1 -1
  25. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.cjs.map +1 -1
  26. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts +0 -4
  27. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.cts.map +1 -1
  28. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts +0 -4
  29. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.d.mts.map +1 -1
  30. package/dist/components/BottomSheetDialog/BottomSheetDialog.types.mjs.map +1 -1
  31. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs +5 -21
  32. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs.map +1 -1
  33. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.cjs +3 -5
  34. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.cjs.map +1 -1
  35. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.cts +1 -3
  36. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.cts.map +1 -1
  37. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.mts +1 -3
  38. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.d.mts.map +1 -1
  39. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.mjs +2 -4
  40. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.constants.mjs.map +1 -1
  41. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.cts +2 -6
  42. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.cts.map +1 -1
  43. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.mts +2 -6
  44. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.mts.map +1 -1
  45. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs +7 -24
  46. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs.map +1 -1
  47. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.cjs.map +1 -1
  48. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.cts +0 -13
  49. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.cts.map +1 -1
  50. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.mts +0 -13
  51. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.d.mts.map +1 -1
  52. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.types.mjs.map +1 -1
  53. package/dist/components/BottomSheetOverlay/index.cjs.map +1 -1
  54. package/dist/components/BottomSheetOverlay/index.d.cts +1 -1
  55. package/dist/components/BottomSheetOverlay/index.d.cts.map +1 -1
  56. package/dist/components/BottomSheetOverlay/index.d.mts +1 -1
  57. package/dist/components/BottomSheetOverlay/index.d.mts.map +1 -1
  58. package/dist/components/BottomSheetOverlay/index.mjs.map +1 -1
  59. package/dist/components/index.cjs.map +1 -1
  60. package/dist/components/index.d.cts +1 -1
  61. package/dist/components/index.d.cts.map +1 -1
  62. package/dist/components/index.d.mts +1 -1
  63. package/dist/components/index.d.mts.map +1 -1
  64. package/dist/components/index.mjs.map +1 -1
  65. package/package.json +4 -4
@@ -36,7 +36,6 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
36
36
  const { y: frameY } = (0, react_native_safe_area_context_1.useSafeAreaFrame)();
37
37
  const postCallback = (0, react_1.useRef)(undefined);
38
38
  const bottomSheetDialogRef = (0, react_1.useRef)(null);
39
- const bottomSheetOverlayRef = (0, react_1.useRef)(null);
40
39
  const didNavigateBackRef = (0, react_1.useRef)(false);
41
40
  const closeRequestedRef = (0, react_1.useRef)(false);
42
41
  const didRunPostCallbackRef = (0, react_1.useRef)(false);
@@ -64,12 +63,6 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
64
63
  callback?.();
65
64
  }
66
65
  }, [goBack, onClose]);
67
- const onDismissStart = (0, react_1.useCallback)(() => {
68
- bottomSheetOverlayRef.current?.fadeOut();
69
- }, []);
70
- const dismissSheet = (0, react_1.useCallback)((callback) => {
71
- bottomSheetDialogRef.current?.onCloseDialog(callback);
72
- }, []);
73
66
  // Dismiss the sheet when Android back button is pressed.
74
67
  (0, react_1.useEffect)(() => {
75
68
  if (react_native_1.Platform.OS !== 'android') {
@@ -77,7 +70,7 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
77
70
  }
78
71
  const hardwareBackPress = () => {
79
72
  if (isInteractable) {
80
- dismissSheet();
73
+ bottomSheetDialogRef.current?.onCloseDialog();
81
74
  }
82
75
  return true;
83
76
  };
@@ -85,7 +78,7 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
85
78
  return () => {
86
79
  subscription.remove();
87
80
  };
88
- }, [dismissSheet, isInteractable]);
81
+ }, [isInteractable]);
89
82
  (0, react_1.useImperativeHandle)(ref, () => ({
90
83
  onCloseBottomSheet: (callback) => {
91
84
  if (closeRequestedRef.current) {
@@ -93,7 +86,7 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
93
86
  }
94
87
  closeRequestedRef.current = true;
95
88
  postCallback.current = callback;
96
- dismissSheet();
89
+ bottomSheetDialogRef.current?.onCloseDialog();
97
90
  },
98
91
  onOpenBottomSheet: (callback) => {
99
92
  didNavigateBackRef.current = false;
@@ -104,8 +97,10 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
104
97
  },
105
98
  }));
106
99
  return (<react_native_1.KeyboardAvoidingView behavior={react_native_1.Platform.OS === 'ios' ? 'padding' : undefined} keyboardVerticalOffset={react_native_1.Platform.OS === 'ios' ? -screenBottomPadding : frameY} style={[tw.style('absolute inset-0 justify-end'), style]} enabled={keyboardAvoidingViewEnabled} {...props}>
107
- <BottomSheetOverlay_1.BottomSheetOverlay ref={bottomSheetOverlayRef} onPress={isInteractable ? () => dismissSheet() : undefined}/>
108
- <BottomSheetDialog_1.BottomSheetDialog isInteractable={isInteractable} onDismissStart={onDismissStart} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}>
100
+ <BottomSheetOverlay_1.BottomSheetOverlay onPress={isInteractable
101
+ ? () => bottomSheetDialogRef.current?.onCloseDialog()
102
+ : undefined}/>
103
+ <BottomSheetDialog_1.BottomSheetDialog isInteractable={isInteractable} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}>
109
104
  {children}
110
105
  </BottomSheetDialog_1.BottomSheetDialog>
111
106
  </react_native_1.KeyboardAvoidingView>);
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAMe;AACf,+CAA2E;AAC3E,mFAGwC;AAExC,sEAAyD;AAEzD,qFAA8E;AASjE,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,CACE,EACE,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,WAAW,EACX,cAAc,GAAG,IAAI,EACrB,YAAY,GAAG,KAAK,EACpB,2BAA2B,GAAG,IAAI,EAClC,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAA,kDAAiB,GAAE,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAA,iDAAgB,GAAE,CAAC;IACzC,MAAM,YAAY,GAAG,IAAA,cAAM,EAAsC,SAAS,CAAC,CAAC;IAC5E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QAAA,EAAE,qCAAiB,CACrB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport { BottomSheetDialog } from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\nimport type { BottomSheetOverlayRef } from '../BottomSheetOverlay/BottomSheetOverlay.types';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback | undefined>(undefined);\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const bottomSheetOverlayRef = useRef<BottomSheetOverlayRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (goBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack?.();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose]);\n\n const onDismissStart = useCallback(() => {\n bottomSheetOverlayRef.current?.fadeOut();\n }, []);\n\n const dismissSheet = useCallback((callback?: () => void) => {\n bottomSheetDialogRef.current?.onCloseDialog(callback);\n }, []);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n if (Platform.OS !== 'android') {\n return undefined;\n }\n\n const hardwareBackPress = () => {\n if (isInteractable) {\n dismissSheet();\n }\n return true;\n };\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n hardwareBackPress,\n );\n return () => {\n subscription.remove();\n };\n }, [dismissSheet, isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n dismissSheet();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n ref={bottomSheetOverlayRef}\n onPress={isInteractable ? () => dismissSheet() : undefined}\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onDismissStart={onDismissStart}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
1
+ {"version":3,"file":"BottomSheet.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAA4E;AAC5E,+CAMe;AACf,+CAA2E;AAC3E,mFAGwC;AAExC,sEAAyD;AAEzD,qFAA8E;AAQjE,QAAA,WAAW,GAAG,IAAA,kBAAU,EACnC,CACE,EACE,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,WAAW,EACX,cAAc,GAAG,IAAI,EACrB,YAAY,GAAG,KAAK,EACpB,2BAA2B,GAAG,IAAI,EAClC,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAA,kDAAiB,GAAE,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,IAAA,iDAAgB,GAAE,CAAC;IACzC,MAAM,YAAY,GAAG,IAAA,cAAM,EAAsC,SAAS,CAAC,CAAC;IAC5E,MAAM,oBAAoB,GAAG,IAAA,cAAM,EAAuB,IAAI,CAAC,CAAC;IAChE,MAAM,kBAAkB,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IACxC,MAAM,qBAAqB,GAAG,IAAA,cAAM,EAAC,KAAK,CAAC,CAAC;IAE5C,MAAM,QAAQ,GAAG,IAAA,mBAAW,EAAC,GAAG,EAAE;QAChC,wCAAwC;QACxC,kBAAkB,CAAC,OAAO,GAAG,KAAK,CAAC;QACnC,iBAAiB,CAAC,OAAO,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ACjB,OAAO,CAAC,CACN,cAAc;YACZ,CAAC,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE;YACrD,CAAC,CAAC,SAAS,CACd,EAEH;QAAA,CAAC,qCAAiB,CAChB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,MAAM,CAAC,CAAC,QAAQ,CAAC,CACjB,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAC1B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,CAEzD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,qCAAiB,CACrB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,mBAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport { BottomSheetDialog } from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback | undefined>(undefined);\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (goBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack?.();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose]);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n if (Platform.OS !== 'android') {\n return undefined;\n }\n\n const hardwareBackPress = () => {\n if (isInteractable) {\n bottomSheetDialogRef.current?.onCloseDialog();\n }\n return true;\n };\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n hardwareBackPress,\n );\n return () => {\n subscription.remove();\n };\n }, [isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onCloseDialog();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n onPress={\n isInteractable\n ? () => bottomSheetDialogRef.current?.onCloseDialog()\n : undefined\n }\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
@@ -8,7 +8,6 @@ export declare const BottomSheet: React.ForwardRefExoticComponent<{
8
8
  isFullscreen?: boolean | undefined;
9
9
  isInteractable?: boolean | undefined;
10
10
  keyboardAvoidingViewEnabled?: boolean | undefined;
11
- onDismissStart?: (() => void) | undefined;
12
11
  onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
13
12
  onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
14
13
  twClassName?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAYf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;;2EAoIvB,CAAC"}
1
+ {"version":3,"file":"BottomSheet.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAWf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;2EA6HvB,CAAC"}
@@ -8,7 +8,6 @@ export declare const BottomSheet: React.ForwardRefExoticComponent<{
8
8
  isFullscreen?: boolean | undefined;
9
9
  isInteractable?: boolean | undefined;
10
10
  keyboardAvoidingViewEnabled?: boolean | undefined;
11
- onDismissStart?: (() => void) | undefined;
12
11
  onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
13
12
  onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
14
13
  twClassName?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAYf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;;2EAoIvB,CAAC"}
1
+ {"version":3,"file":"BottomSheet.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":"AACA,OAAO,KAMN,cAAc;AAWf,OAAO,KAAK,EAGV,cAAc,EACf,gCAA4B;AAE7B,eAAO,MAAM,WAAW;;;;;;;;;;;2EA6HvB,CAAC"}
@@ -17,7 +17,6 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
17
17
  const { y: frameY } = useSafeAreaFrame();
18
18
  const postCallback = useRef(undefined);
19
19
  const bottomSheetDialogRef = useRef(null);
20
- const bottomSheetOverlayRef = useRef(null);
21
20
  const didNavigateBackRef = useRef(false);
22
21
  const closeRequestedRef = useRef(false);
23
22
  const didRunPostCallbackRef = useRef(false);
@@ -45,12 +44,6 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
45
44
  callback?.();
46
45
  }
47
46
  }, [goBack, onClose]);
48
- const onDismissStart = useCallback(() => {
49
- bottomSheetOverlayRef.current?.fadeOut();
50
- }, []);
51
- const dismissSheet = useCallback((callback) => {
52
- bottomSheetDialogRef.current?.onCloseDialog(callback);
53
- }, []);
54
47
  // Dismiss the sheet when Android back button is pressed.
55
48
  useEffect(() => {
56
49
  if (Platform.OS !== 'android') {
@@ -58,7 +51,7 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
58
51
  }
59
52
  const hardwareBackPress = () => {
60
53
  if (isInteractable) {
61
- dismissSheet();
54
+ bottomSheetDialogRef.current?.onCloseDialog();
62
55
  }
63
56
  return true;
64
57
  };
@@ -66,7 +59,7 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
66
59
  return () => {
67
60
  subscription.remove();
68
61
  };
69
- }, [dismissSheet, isInteractable]);
62
+ }, [isInteractable]);
70
63
  useImperativeHandle(ref, () => ({
71
64
  onCloseBottomSheet: (callback) => {
72
65
  if (closeRequestedRef.current) {
@@ -74,7 +67,7 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
74
67
  }
75
68
  closeRequestedRef.current = true;
76
69
  postCallback.current = callback;
77
- dismissSheet();
70
+ bottomSheetDialogRef.current?.onCloseDialog();
78
71
  },
79
72
  onOpenBottomSheet: (callback) => {
80
73
  didNavigateBackRef.current = false;
@@ -85,8 +78,10 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
85
78
  },
86
79
  }));
87
80
  return (<KeyboardAvoidingView behavior={Platform.OS === 'ios' ? 'padding' : undefined} keyboardVerticalOffset={Platform.OS === 'ios' ? -screenBottomPadding : frameY} style={[tw.style('absolute inset-0 justify-end'), style]} enabled={keyboardAvoidingViewEnabled} {...props}>
88
- <BottomSheetOverlay ref={bottomSheetOverlayRef} onPress={isInteractable ? () => dismissSheet() : undefined}/>
89
- <BottomSheetDialog isInteractable={isInteractable} onDismissStart={onDismissStart} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}>
81
+ <BottomSheetOverlay onPress={isInteractable
82
+ ? () => bottomSheetDialogRef.current?.onCloseDialog()
83
+ : undefined}/>
84
+ <BottomSheetDialog isInteractable={isInteractable} onClose={onCloseCB} onOpen={onOpenCB} ref={bottomSheetDialogRef} isFullscreen={isFullscreen} twClassName={twClassName} keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}>
90
85
  {children}
91
86
  </BottomSheetDialog>
92
87
  </KeyboardAvoidingView>);
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,mBAAmB,EACnB,MAAM,EACP,cAAc;;AACf,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,QAAQ,EAAE,qBAAqB;AAC3E,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EAClB,uCAAuC;AAExC,OAAO,EAAE,iBAAiB,EAAE,uCAA6B;AAEzD,OAAO,EAAE,kBAAkB,EAAE,qDAAiD;AAS9E,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACnC,CACE,EACE,QAAQ,EACR,OAAO,EACP,MAAM,EACN,MAAM,EACN,KAAK,EACL,WAAW,EACX,cAAc,GAAG,IAAI,EACrB,YAAY,GAAG,KAAK,EACpB,2BAA2B,GAAG,IAAI,EAClC,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IACzB,MAAM,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAC5D,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE,CAAC;IACzC,MAAM,YAAY,GAAG,MAAM,CAAsC,SAAS,CAAC,CAAC;IAC5E,MAAM,oBAAoB,GAAG,MAAM,CAAuB,IAAI,CAAC,CAAC;IAChE,MAAM,qBAAqB,GAAG,MAAM,CAAwB,IAAI,CAAC,CAAC;IAClE,MAAM,kBAAkB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC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oBAAoB,CACnB,QAAQ,CAAC,CAAC,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CACxD,sBAAsB,CAAC,CACrB,QAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CACtD,CACD,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,8BAA8B,CAAC,EAAE,KAAK,CAAC,CAAC,CACzD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,kBAAkB,CACjB,GAAG,CAAC,CAAC,qBAAqB,CAAC,CAC3B,OAAO,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAE7D;QAAA,CAAC,iBAAiB,CAChB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,MAAM,CAAC,CAAC,QAAQ,CAAC,CACjB,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAC1B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,CAEzD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,iBAAiB,CACrB;MAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport { BottomSheetDialog } from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\nimport type { BottomSheetOverlayRef } from '../BottomSheetOverlay/BottomSheetOverlay.types';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback | undefined>(undefined);\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const bottomSheetOverlayRef = useRef<BottomSheetOverlayRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (goBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack?.();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose]);\n\n const onDismissStart = useCallback(() => {\n bottomSheetOverlayRef.current?.fadeOut();\n }, []);\n\n const dismissSheet = useCallback((callback?: () => void) => {\n bottomSheetDialogRef.current?.onCloseDialog(callback);\n }, []);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n if (Platform.OS !== 'android') {\n return undefined;\n }\n\n const hardwareBackPress = () => {\n if (isInteractable) {\n dismissSheet();\n }\n return true;\n };\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n hardwareBackPress,\n );\n return () => {\n subscription.remove();\n };\n }, [dismissSheet, isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n dismissSheet();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n ref={bottomSheetOverlayRef}\n onPress={isInteractable ? () => dismissSheet() : undefined}\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onDismissStart={onDismissStart}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
1
+ {"version":3,"file":"BottomSheet.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,QAAO,EACZ,UAAU,EACV,W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ChB,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,OAAO,CAAC,CAAC,SAAS,CAAC,CACnB,MAAM,CAAC,CAAC,QAAQ,CAAC,CACjB,GAAG,CAAC,CAAC,oBAAoB,CAAC,CAC1B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,WAAW,CAAC,CAAC,WAAW,CAAC,CACzB,2BAA2B,CAAC,CAAC,2BAA2B,CAAC,CAEzD;UAAA,CAAC,QAAQ,CACX;QAAA,EAAE,iBAAiB,CACrB;MAAA,EAAE,oBAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC","sourcesContent":["import { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useImperativeHandle,\n useRef,\n} from 'react';\nimport { BackHandler, KeyboardAvoidingView, Platform } from 'react-native';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\nimport { BottomSheetDialog } from '../BottomSheetDialog';\nimport type { BottomSheetDialogRef } from '../BottomSheetDialog';\nimport { BottomSheetOverlay } from '../BottomSheetOverlay/BottomSheetOverlay';\n\nimport type {\n BottomSheetPostCallback,\n BottomSheetProps,\n BottomSheetRef,\n} from './BottomSheet.types';\n\nexport const BottomSheet = forwardRef<BottomSheetRef, BottomSheetProps>(\n (\n {\n children,\n onClose,\n onOpen,\n goBack,\n style,\n twClassName,\n isInteractable = true,\n isFullscreen = false,\n keyboardAvoidingViewEnabled = true,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const { bottom: screenBottomPadding } = useSafeAreaInsets();\n const { y: frameY } = useSafeAreaFrame();\n const postCallback = useRef<BottomSheetPostCallback | undefined>(undefined);\n const bottomSheetDialogRef = useRef<BottomSheetDialogRef>(null);\n const didNavigateBackRef = useRef(false);\n const closeRequestedRef = useRef(false);\n const didRunPostCallbackRef = useRef(false);\n\n const onOpenCB = useCallback(() => {\n // Reset when the sheet is opened again.\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n\n onOpen?.(Boolean(postCallback.current));\n const callback = postCallback.current;\n postCallback.current = undefined;\n callback?.();\n }, [onOpen]);\n\n const onCloseCB = useCallback(() => {\n if (goBack && !didNavigateBackRef.current) {\n didNavigateBackRef.current = true;\n goBack?.();\n }\n\n const callback = postCallback.current;\n const hasCallback = Boolean(callback);\n\n onClose?.(hasCallback);\n\n if (!didRunPostCallbackRef.current && hasCallback) {\n didRunPostCallbackRef.current = true;\n postCallback.current = undefined;\n callback?.();\n }\n }, [goBack, onClose]);\n\n // Dismiss the sheet when Android back button is pressed.\n useEffect(() => {\n if (Platform.OS !== 'android') {\n return undefined;\n }\n\n const hardwareBackPress = () => {\n if (isInteractable) {\n bottomSheetDialogRef.current?.onCloseDialog();\n }\n return true;\n };\n const subscription = BackHandler.addEventListener(\n 'hardwareBackPress',\n hardwareBackPress,\n );\n return () => {\n subscription.remove();\n };\n }, [isInteractable]);\n\n useImperativeHandle(ref, () => ({\n onCloseBottomSheet: (callback) => {\n if (closeRequestedRef.current) {\n return;\n }\n closeRequestedRef.current = true;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onCloseDialog();\n },\n onOpenBottomSheet: (callback) => {\n didNavigateBackRef.current = false;\n closeRequestedRef.current = false;\n didRunPostCallbackRef.current = false;\n postCallback.current = callback;\n bottomSheetDialogRef.current?.onOpenDialog();\n },\n }));\n\n return (\n <KeyboardAvoidingView\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n style={[tw.style('absolute inset-0 justify-end'), style]}\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <BottomSheetOverlay\n onPress={\n isInteractable\n ? () => bottomSheetDialogRef.current?.onCloseDialog()\n : undefined\n }\n />\n <BottomSheetDialog\n isInteractable={isInteractable}\n onClose={onCloseCB}\n onOpen={onOpenCB}\n ref={bottomSheetDialogRef}\n isFullscreen={isFullscreen}\n twClassName={twClassName}\n keyboardAvoidingViewEnabled={keyboardAvoidingViewEnabled}\n >\n {children}\n </BottomSheetDialog>\n </KeyboardAvoidingView>\n );\n },\n);\n\nBottomSheet.displayName = 'BottomSheet';\n"]}
@@ -34,12 +34,13 @@ const react_native_reanimated_1 = __importStar(require("react-native-reanimated"
34
34
  const react_native_safe_area_context_1 = require("react-native-safe-area-context");
35
35
  // Internal dependencies.
36
36
  const BottomSheetDialog_constants_1 = require("./BottomSheetDialog.constants.cjs");
37
- exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onDismissStart, onClose, onOpen, style, twClassName, ...props }, ref) => {
37
+ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen = false, isInteractable = true, keyboardAvoidingViewEnabled = true, onClose, onOpen, style, twClassName, ...props }, ref) => {
38
38
  const tw = (0, design_system_twrnc_preset_1.useTailwind)();
39
39
  const currentTheme = (0, design_system_twrnc_preset_1.useTheme)();
40
+ const isPureBlack = (0, design_system_twrnc_preset_1.usePureBlack)();
40
41
  const shadowLg = currentTheme === design_system_twrnc_preset_1.Theme.Light
41
42
  ? design_tokens_1.lightTheme.shadows.size.lg
42
- : design_tokens_1.darkTheme.shadows.size.lg;
43
+ : (0, design_tokens_1.resolveDarkTheme)(isPureBlack).shadows.size.lg;
43
44
  const { top: screenTopPadding, bottom: screenBottomPadding } = (0, react_native_safe_area_context_1.useSafeAreaInsets)();
44
45
  const { y: frameY, height: screenHeight } = (0, react_native_safe_area_context_1.useSafeAreaFrame)();
45
46
  const maxSheetHeight = screenHeight - screenTopPadding;
@@ -56,23 +57,15 @@ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen =
56
57
  const onCloseCB = (0, react_1.useCallback)(() => {
57
58
  onClose?.();
58
59
  }, [onClose]);
59
- const animateSheetTo = (target, onComplete) => {
60
- currentYOffset.value = (0, react_native_reanimated_1.withSpring)(target, (0, BottomSheetDialog_constants_1.getBottomSheetDialogSpringConfig)(), (finished) => {
61
- if (finished && onComplete) {
62
- (0, react_native_reanimated_1.runOnJS)(onComplete)();
63
- }
64
- });
65
- };
66
60
  const onCloseDialog = (0, react_1.useCallback)((callback) => {
67
- onDismissStart?.();
68
- animateSheetTo(bottomOfDialogYValue.value, () => {
69
- onCloseCB();
61
+ currentYOffset.value = (0, react_native_reanimated_1.withTiming)(bottomOfDialogYValue.value, { duration: BottomSheetDialog_constants_1.DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION }, () => {
62
+ (0, react_native_reanimated_1.runOnJS)(onCloseCB)();
70
63
  if (callback) {
71
- callback();
64
+ (0, react_native_reanimated_1.runOnJS)(callback)();
72
65
  }
73
66
  });
74
67
  // Ref values do not affect deps.
75
- }, [onCloseCB, onDismissStart]);
68
+ }, [onCloseCB]);
76
69
  const gestureHandler = (0, react_1.useMemo)(() => {
77
70
  // These gesture callbacks need explicit 'worklet' directives because this
78
71
  // package ships a pre-built dist compiled by ts-bridge (tsc), which emits the
@@ -119,7 +112,7 @@ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen =
119
112
  BottomSheetDialog_constants_1.DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;
120
113
  // Check if the gesture's vertical speed has reached the threshold to determine a swipe action
121
114
  const hasReachedSwipeThreshold = Math.abs(velocityY) >
122
- BottomSheetDialog_constants_1.DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY;
115
+ BottomSheetDialog_constants_1.DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;
123
116
  const isQuickDismissing = velocityY > 0;
124
117
  // If user is swiping
125
118
  if (hasReachedSwipeThreshold) {
@@ -142,7 +135,10 @@ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen =
142
135
  (0, react_native_reanimated_1.runOnJS)(onCloseDialog)();
143
136
  }
144
137
  else {
145
- currentYOffset.value = (0, react_native_reanimated_1.withSpring)(finalYOffset, (0, BottomSheetDialog_constants_1.getBottomSheetDialogSpringConfig)({ velocity: velocityY }));
138
+ // Only animate dialog to a certain Y position instead
139
+ currentYOffset.value = (0, react_native_reanimated_1.withTiming)(finalYOffset, {
140
+ duration: BottomSheetDialog_constants_1.DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,
141
+ });
146
142
  }
147
143
  });
148
144
  return gesture;
@@ -156,11 +152,15 @@ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen =
156
152
  ]);
157
153
  // Animate in sheet on initial render.
158
154
  const onOpenDialog = (callback) => {
155
+ // Starts setting the Y position of the dialog to the bottom of the dialog
159
156
  currentYOffset.value = bottomOfDialogYValue.value;
160
- animateSheetTo(topOfDialogYValue.value, () => {
161
- onOpenCB();
157
+ // Animate the Y position to the top of the dialog, then call onOpenCB
158
+ currentYOffset.value = (0, react_native_reanimated_1.withTiming)(topOfDialogYValue.value, {
159
+ duration: BottomSheetDialog_constants_1.DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,
160
+ }, () => {
161
+ (0, react_native_reanimated_1.runOnJS)(onOpenCB)();
162
162
  if (callback) {
163
- callback();
163
+ (0, react_native_reanimated_1.runOnJS)(callback)();
164
164
  }
165
165
  });
166
166
  };
@@ -188,7 +188,7 @@ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen =
188
188
  ],
189
189
  }), []);
190
190
  const sheetStyle = (0, react_1.useMemo)(() => [
191
- tw.style('bg-default rounded-t-3xl overflow-hidden border border-muted', twClassName),
191
+ tw.style(isPureBlack ? 'bg-alternative' : 'bg-default', 'rounded-t-3xl overflow-hidden border border-muted', twClassName),
192
192
  {
193
193
  maxHeight: maxSheetHeight,
194
194
  paddingBottom: react_native_1.Platform.select({
@@ -202,6 +202,7 @@ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen =
202
202
  style,
203
203
  ], [
204
204
  tw,
205
+ isPureBlack,
205
206
  maxSheetHeight,
206
207
  screenBottomPadding,
207
208
  isFullscreen,
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAIuD;AACvD,oEAAyE;AACzE,mCAAkC;AAClC,+CAOe;AACf,+CAKsB;AACtB,+EAAwE;AACxE,mFAKiC;AACjC,mFAGwC;AAExC,yBAAyB;AACzB,mFAIuC;AAM1B,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EAIzC,CACE,EACE,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,IAAI,EACrB,2BAA2B,GAAG,IAAI,EAClC,cAAc,EACd,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,YAAY,GAAG,IAAA,qCAAQ,GAAE,CAAC;IAChC,MAAM,QAAQ,GACZ,YAAY,KAAK,kCAAK,CAAC,KAAK;QAC1B,CAAC,CAAC,0BAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC5B,CAAC,CAAC,yBAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IAEhC,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAC1D,IAAA,kDAAiB,GAAE,CAAC;IACtB,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,iDAAgB,GAAE,CAAC;IAE/D,MAAM,cAAc,GAAG,YAAY,GAAG,gBAAgB,CAAC;IACvD,iDAAiD;IACjD,sEAAsE;IACtE,MAAM,cAAc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AA,EAAE,iCAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,8CAAe,CACnB;MAAA,EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n Theme,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, darkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withSpring,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY,\n getBottomSheetDialogSpringConfig,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nexport const BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onDismissStart,\n onClose,\n onOpen,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : darkTheme.shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const gestureStartYOffset = useSharedValue(0);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const animateSheetTo = (target: number, onComplete?: () => void) => {\n currentYOffset.value = withSpring(\n target,\n getBottomSheetDialogSpringConfig(),\n (finished) => {\n if (finished && onComplete) {\n runOnJS(onComplete)();\n }\n },\n );\n };\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n onDismissStart?.();\n animateSheetTo(bottomOfDialogYValue.value, () => {\n onCloseCB();\n if (callback) {\n callback();\n }\n });\n // Ref values do not affect deps.\n },\n [onCloseCB, onDismissStart],\n );\n\n const gestureHandler = useMemo(() => {\n // These gesture callbacks need explicit 'worklet' directives because this\n // package ships a pre-built dist compiled by ts-bridge (tsc), which emits the\n // gesture chain as a namespaced call (react_native_gesture_handler_1.Gesture).\n // The consumer's Reanimated/Worklets Babel plugin does run over dist (that's\n // why useAnimatedStyle below works), but its gesture auto-detection doesn't\n // recognize that compiled namespaced form, so without these directives the\n // callbacks run on the JS thread and slow drags lag behind the finger.\n const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n 'worklet';\n\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\n 'worklet';\n\n const { translationY } = event;\n currentYOffset.value = gestureStartYOffset.value + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n })\n .onEnd((event) => {\n 'worklet';\n\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = gestureStartYOffset.value + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n currentYOffset.value = withSpring(\n finalYOffset,\n getBottomSheetDialogSpringConfig({ velocity: velocityY }),\n );\n }\n });\n\n return gesture;\n }, [\n isInteractable,\n currentYOffset,\n gestureStartYOffset,\n bottomOfDialogYValue,\n topOfDialogYValue,\n onCloseDialog,\n ]);\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n currentYOffset.value = bottomOfDialogYValue.value;\n animateSheetTo(topOfDialogYValue.value, () => {\n onOpenCB();\n if (callback) {\n callback();\n }\n });\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(\n () => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }),\n [],\n );\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n 'bg-default rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <GestureDetector gesture={gestureHandler}>\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </GestureDetector>\n </KeyboardAvoidingView>\n );\n },\n);\n"]}
1
+ {"version":3,"file":"BottomSheetDialog.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,8FAKuD;AACvD,oEAAgF;AAChF,mCAAkC;AAClC,+CAOe;AACf,+CAKsB;AACtB,+EAAwE;AACxE,mFAKiC;AACjC,mFAGwC;AAExC,yBAAyB;AACzB,mFAIuC;AAM1B,QAAA,iBAAiB,GAAG,IAAA,kBAAU,EAIzC,CACE,EACE,QAAQ,EACR,YAAY,GAAG,KAAK,EACpB,cAAc,GAAG,IAAI,EACrB,2BAA2B,GAAG,IAAI,EAClC,OAAO,EACP,MAAM,EACN,KAAK,EACL,WAAW,EACX,GAAG,KAAK,EACT,EACD,GAAG,EACH,EAAE;IACF,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IACzB,MAAM,YAAY,GAAG,IAAA,qCAAQ,GAAE,CAAC;IAChC,MAAM,WAAW,GAAG,IAAA,yCAAY,GAAE,CAAC;IACnC,MAAM,QAAQ,GACZ,YAAY,KAAK,kCAAK,CAAC,KAAK;QAC1B,CAAC,CAAC,0BAAU,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QAC5B,CAAC,CAAC,IAAA,gCAAgB,EAAC,WAAW,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;IAEpD,MAAM,EAAE,GAAG,EAAE,gBAAgB,EAAE,MAAM,EAAE,mBAAmB,EAAE,GAC1D,IAAA,kDAAiB,GAAE,CAAC;IACtB,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,IAAA,iDAAgB,GAAE,CAAC;IAE/D,MAAM,cAAc,GAAG,YAAY,GAAG,gBAAgB,CAAC;IACvD,iDAAiD;IACjD,sEAAsE;IACtE,MAAM,cAAc,GAAG,IAAA,wCAAc,EAAC,YAAY,CAAC,CAAC;IACpD,MA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EAAE,mCAAoB,CAAC,CACxB,CAAC;AACJ,CAAC,CACF,CAAC","sourcesContent":["import {\n Theme,\n usePureBlack,\n useTailwind,\n useTheme,\n} from '@metamask-previews/design-system-twrnc-preset';\nimport { lightTheme, resolveDarkTheme } from '@metamask-previews/design-tokens';\nimport { debounce } from 'lodash';\nimport React, {\n forwardRef,\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useImperativeHandle,\n} from 'react';\nimport {\n LayoutChangeEvent,\n View,\n Platform,\n KeyboardAvoidingView,\n} from 'react-native';\nimport { Gesture, GestureDetector } from 'react-native-gesture-handler';\nimport Animated, {\n runOnJS,\n useAnimatedStyle,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport {\n useSafeAreaFrame,\n useSafeAreaInsets,\n} from 'react-native-safe-area-context';\n\n// Internal dependencies.\nimport {\n DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD,\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION,\n} from './BottomSheetDialog.constants';\nimport type {\n BottomSheetDialogRef,\n BottomSheetDialogProps,\n} from './BottomSheetDialog.types';\n\nexport const BottomSheetDialog = forwardRef<\n BottomSheetDialogRef,\n BottomSheetDialogProps\n>(\n (\n {\n children,\n isFullscreen = false,\n isInteractable = true,\n keyboardAvoidingViewEnabled = true,\n onClose,\n onOpen,\n style,\n twClassName,\n ...props\n },\n ref,\n ) => {\n const tw = useTailwind();\n const currentTheme = useTheme();\n const isPureBlack = usePureBlack();\n const shadowLg =\n currentTheme === Theme.Light\n ? lightTheme.shadows.size.lg\n : resolveDarkTheme(isPureBlack).shadows.size.lg;\n\n const { top: screenTopPadding, bottom: screenBottomPadding } =\n useSafeAreaInsets();\n const { y: frameY, height: screenHeight } = useSafeAreaFrame();\n\n const maxSheetHeight = screenHeight - screenTopPadding;\n // X and Y values start on top left of the DIALOG\n // currentYOffset will be used to animate the Y position of the Dialog\n const currentYOffset = useSharedValue(screenHeight);\n const topOfDialogYValue = useSharedValue(0);\n const bottomOfDialogYValue = useSharedValue(screenHeight);\n const gestureStartYOffset = useSharedValue(0);\n const isMounted = useRef(false);\n\n const onOpenCB = useCallback(() => {\n onOpen?.();\n }, [onOpen]);\n const onCloseCB = useCallback(() => {\n onClose?.();\n }, [onClose]);\n\n const onCloseDialog = useCallback(\n (callback?: () => void) => {\n currentYOffset.value = withTiming(\n bottomOfDialogYValue.value,\n { duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION },\n () => {\n runOnJS(onCloseCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n // Ref values do not affect deps.\n },\n [onCloseCB],\n );\n\n const gestureHandler = useMemo(() => {\n // These gesture callbacks need explicit 'worklet' directives because this\n // package ships a pre-built dist compiled by ts-bridge (tsc), which emits the\n // gesture chain as a namespaced call (react_native_gesture_handler_1.Gesture).\n // The consumer's Reanimated/Worklets Babel plugin does run over dist (that's\n // why useAnimatedStyle below works), but its gesture auto-detection doesn't\n // recognize that compiled namespaced form, so without these directives the\n // callbacks run on the JS thread and slow drags lag behind the finger.\n const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n 'worklet';\n\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\n 'worklet';\n\n const { translationY } = event;\n currentYOffset.value = gestureStartYOffset.value + translationY;\n // If gesture Y value goes above the bottom of Dialog Y value(bottom of dialog),\n // which means the gesture is currently below the bottom of the dialog,\n // sets it to bottom of Dialog Y value\n if (currentYOffset.value >= bottomOfDialogYValue.value) {\n currentYOffset.value = bottomOfDialogYValue.value;\n }\n // If gesture Y value goes below the top of Dialog Y value(top of dialog),\n // which means the gesture is currently above the top of the dialog,\n // sets it to top of Dialog Y value\n if (currentYOffset.value <= topOfDialogYValue.value) {\n currentYOffset.value = topOfDialogYValue.value;\n }\n })\n .onEnd((event) => {\n 'worklet';\n\n const { translationY, velocityY } = event;\n // finalYOffset is used to animate the Y position of the Dialog after the gesture event\n let finalYOffset: number;\n // Measuring dismissing swipe action\n const latestOffset = gestureStartYOffset.value + translationY;\n // Check if the swipe distance reach the dismiss offset threshold,\n // which is currently 60% of sheet height\n const hasReachedDismissOffset =\n latestOffset >\n bottomOfDialogYValue.value *\n DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD;\n // Check if the gesture's vertical speed has reached the threshold to determine a swipe action\n const hasReachedSwipeThreshold =\n Math.abs(velocityY) >\n DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION;\n const isQuickDismissing = velocityY > 0;\n\n // If user is swiping\n if (hasReachedSwipeThreshold) {\n // Quick swipe takes priority\n if (isQuickDismissing) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n } else if (hasReachedDismissOffset) {\n finalYOffset = bottomOfDialogYValue.value;\n } else {\n finalYOffset = topOfDialogYValue.value;\n }\n\n const isDismissed = finalYOffset === bottomOfDialogYValue.value;\n\n if (isDismissed) {\n runOnJS(onCloseDialog)();\n } else {\n // Only animate dialog to a certain Y position instead\n currentYOffset.value = withTiming(finalYOffset, {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n });\n }\n });\n\n return gesture;\n }, [\n isInteractable,\n currentYOffset,\n gestureStartYOffset,\n bottomOfDialogYValue,\n topOfDialogYValue,\n onCloseDialog,\n ]);\n\n // Animate in sheet on initial render.\n const onOpenDialog = (callback?: () => void) => {\n // Starts setting the Y position of the dialog to the bottom of the dialog\n currentYOffset.value = bottomOfDialogYValue.value;\n // Animate the Y position to the top of the dialog, then call onOpenCB\n currentYOffset.value = withTiming(\n topOfDialogYValue.value,\n {\n duration: DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION,\n },\n () => {\n runOnJS(onOpenCB)();\n if (callback) {\n runOnJS(callback)();\n }\n },\n );\n };\n\n const onDebouncedCloseDialog = useMemo(\n // Prevent hide from being called multiple times. Potentially caused by taps in quick succession.\n () => debounce(onCloseDialog, 2000, { leading: true }),\n [onCloseDialog],\n );\n\n useEffect(\n () =>\n // Automatically handles animation when content changes\n // Disable for now since network switches causes the screen to hang with this on.\n // LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);\n onDebouncedCloseDialog.cancel(),\n [children, onDebouncedCloseDialog],\n );\n\n const updateSheetHeight = (e: LayoutChangeEvent) => {\n const { height } = e.nativeEvent.layout;\n bottomOfDialogYValue.value = height;\n\n if (!isMounted.current) {\n isMounted.current = true;\n onOpenDialog();\n }\n };\n\n const animatedSheetStyle = useAnimatedStyle(\n () => ({\n transform: [\n {\n translateY: currentYOffset.value,\n },\n ],\n }),\n [],\n );\n\n const sheetStyle = useMemo(\n () => [\n tw.style(\n isPureBlack ? 'bg-alternative' : 'bg-default',\n 'rounded-t-3xl overflow-hidden border border-muted',\n twClassName,\n ),\n {\n maxHeight: maxSheetHeight,\n paddingBottom: Platform.select({\n ios: screenBottomPadding,\n macos: screenBottomPadding,\n default: screenBottomPadding + 16,\n }),\n ...(isFullscreen && { height: maxSheetHeight }),\n ...shadowLg,\n },\n style,\n ],\n\n [\n tw,\n isPureBlack,\n maxSheetHeight,\n screenBottomPadding,\n isFullscreen,\n shadowLg,\n style,\n twClassName,\n ],\n );\n\n const combinedSheetStyle = useMemo(\n () => [...sheetStyle, animatedSheetStyle],\n\n [sheetStyle],\n );\n\n useImperativeHandle(ref, () => ({\n onOpenDialog,\n onCloseDialog,\n }));\n\n return (\n <KeyboardAvoidingView\n style={tw.style('absolute bottom-0 inset-x-0')}\n behavior={Platform.OS === 'ios' ? 'padding' : undefined}\n keyboardVerticalOffset={\n Platform.OS === 'ios' ? -screenBottomPadding : frameY\n }\n enabled={keyboardAvoidingViewEnabled}\n {...props}\n >\n <GestureDetector gesture={gestureHandler}>\n <Animated.View\n onLayout={updateSheetHeight}\n style={combinedSheetStyle}\n >\n {isInteractable && (\n <View style={tw.style('self-stretch items-center p-1')}>\n <View style={tw.style('h-1 w-10 rounded-sm bg-border-muted')} />\n </View>\n )}\n {children}\n </Animated.View>\n </GestureDetector>\n </KeyboardAvoidingView>\n );\n },\n);\n"]}
@@ -1,25 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = exports.DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY = exports.getBottomSheetDialogSpringConfig = exports.DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG = void 0;
3
+ exports.DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = exports.DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION = exports.DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION = void 0;
4
4
  const design_tokens_1 = require("@metamask-previews/design-tokens");
5
- /** iOS-like sheet spring: natural deceleration with minimal overshoot on open. */
6
- exports.DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG = {
7
- damping: 28,
8
- stiffness: 320,
9
- mass: 0.9,
10
- overshootClamping: true,
11
- };
12
- const getBottomSheetDialogSpringConfig = (overrides) => ({
13
- ...exports.DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG,
14
- ...overrides,
15
- });
16
- exports.getBottomSheetDialogSpringConfig = getBottomSheetDialogSpringConfig;
5
+ // Defaults
17
6
  /**
18
- * Minimum swipe velocity (px/s) to treat the gesture as a fling for snap/dismiss.
7
+ * The animation duration used for initial render.
19
8
  */
20
- exports.DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY = design_tokens_1.AnimationDuration.Regularly;
9
+ exports.DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION = design_tokens_1.AnimationDuration.Fast;
21
10
  /**
22
- * Fraction of sheet height dragged down before dismiss without a fling.
11
+ * This number represents the swipe speed to meet the velocity threshold.
12
+ */
13
+ exports.DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION = design_tokens_1.AnimationDuration.Regularly;
14
+ /**
15
+ * This indicates that 60% of the sheet needs to be offscreen to meet the distance threshold.
23
16
  */
24
17
  exports.DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;
25
18
  //# sourceMappingURL=BottomSheetDialog.constants.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.constants.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":";;;AAAA,oEAAqE;AAGrE,kFAAkF;AACrE,QAAA,uCAAuC,GAAG;IACrD,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,GAAG;IACd,IAAI,EAAE,GAAG;IACT,iBAAiB,EAAE,IAAI;CACY,CAAC;AAM/B,MAAM,gCAAgC,GAAG,CAC9C,SAA4C,EAC1B,EAAE,CAAC,CAAC;IACtB,GAAG,+CAAuC;IAC1C,GAAG,SAAS;CACb,CAAC,CAAC;AALU,QAAA,gCAAgC,oCAK1C;AAEH;;GAEG;AACU,QAAA,iDAAiD,GAC5D,iCAAiB,CAAC,SAAS,CAAC;AAE9B;;GAEG;AACU,QAAA,0CAA0C,GAAG,GAAG,CAAC","sourcesContent":["import { AnimationDuration } from '@metamask-previews/design-tokens';\nimport type { WithSpringConfig } from 'react-native-reanimated';\n\n/** iOS-like sheet spring: natural deceleration with minimal overshoot on open. */\nexport const DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG = {\n damping: 28,\n stiffness: 320,\n mass: 0.9,\n overshootClamping: true,\n} as const satisfies WithSpringConfig;\n\ntype BottomSheetDialogSpringOverrides = Partial<\n Pick<WithSpringConfig, 'velocity' | 'reduceMotion' | 'energyThreshold'>\n>;\n\nexport const getBottomSheetDialogSpringConfig = (\n overrides?: BottomSheetDialogSpringOverrides,\n): WithSpringConfig => ({\n ...DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG,\n ...overrides,\n});\n\n/**\n * Minimum swipe velocity (px/s) to treat the gesture as a fling for snap/dismiss.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY =\n AnimationDuration.Regularly;\n\n/**\n * Fraction of sheet height dragged down before dismiss without a fling.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;\n"]}
1
+ {"version":3,"file":"BottomSheetDialog.constants.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":";;;AAAA,oEAAqE;AAErE,WAAW;AACX;;GAEG;AACU,QAAA,0CAA0C,GACrD,iCAAiB,CAAC,IAAI,CAAC;AACzB;;GAEG;AACU,QAAA,iDAAiD,GAC5D,iCAAiB,CAAC,SAAS,CAAC;AAC9B;;GAEG;AACU,QAAA,0CAA0C,GAAG,GAAG,CAAC","sourcesContent":["import { AnimationDuration } from '@metamask-previews/design-tokens';\n\n// Defaults\n/**\n * The animation duration used for initial render.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION =\n AnimationDuration.Fast;\n/**\n * This number represents the swipe speed to meet the velocity threshold.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION =\n AnimationDuration.Regularly;\n/**\n * This indicates that 60% of the sheet needs to be offscreen to meet the distance threshold.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;\n"]}
@@ -1,21 +1,14 @@
1
1
  import { AnimationDuration } from "@metamask-previews/design-tokens";
2
- import type { WithSpringConfig } from "react-native-reanimated";
3
- /** iOS-like sheet spring: natural deceleration with minimal overshoot on open. */
4
- export declare const DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG: {
5
- readonly damping: 28;
6
- readonly stiffness: 320;
7
- readonly mass: 0.9;
8
- readonly overshootClamping: true;
9
- };
10
- type BottomSheetDialogSpringOverrides = Partial<Pick<WithSpringConfig, 'velocity' | 'reduceMotion' | 'energyThreshold'>>;
11
- export declare const getBottomSheetDialogSpringConfig: (overrides?: BottomSheetDialogSpringOverrides) => WithSpringConfig;
12
2
  /**
13
- * Minimum swipe velocity (px/s) to treat the gesture as a fling for snap/dismiss.
3
+ * The animation duration used for initial render.
14
4
  */
15
- export declare const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY = AnimationDuration.Regularly;
5
+ export declare const DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION = AnimationDuration.Fast;
16
6
  /**
17
- * Fraction of sheet height dragged down before dismiss without a fling.
7
+ * This number represents the swipe speed to meet the velocity threshold.
8
+ */
9
+ export declare const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION = AnimationDuration.Regularly;
10
+ /**
11
+ * This indicates that 60% of the sheet needs to be offscreen to meet the distance threshold.
18
12
  */
19
13
  export declare const DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;
20
- export {};
21
14
  //# sourceMappingURL=BottomSheetDialog.constants.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.constants.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,yCAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAEhE,kFAAkF;AAClF,eAAO,MAAM,uCAAuC;;;;;CAKf,CAAC;AAEtC,KAAK,gCAAgC,GAAG,OAAO,CAC7C,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,cAAc,GAAG,iBAAiB,CAAC,CACxE,CAAC;AAEF,eAAO,MAAM,gCAAgC,eAC/B,gCAAgC,KAC3C,gBAGD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iDAAiD,8BACjC,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,0CAA0C,MAAM,CAAC"}
1
+ {"version":3,"file":"BottomSheetDialog.constants.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,yCAAyC;AAGrE;;GAEG;AACH,eAAO,MAAM,0CAA0C,yBAC/B,CAAC;AACzB;;GAEG;AACH,eAAO,MAAM,iDAAiD,8BACjC,CAAC;AAC9B;;GAEG;AACH,eAAO,MAAM,0CAA0C,MAAM,CAAC"}
@@ -1,21 +1,14 @@
1
1
  import { AnimationDuration } from "@metamask-previews/design-tokens";
2
- import type { WithSpringConfig } from "react-native-reanimated";
3
- /** iOS-like sheet spring: natural deceleration with minimal overshoot on open. */
4
- export declare const DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG: {
5
- readonly damping: 28;
6
- readonly stiffness: 320;
7
- readonly mass: 0.9;
8
- readonly overshootClamping: true;
9
- };
10
- type BottomSheetDialogSpringOverrides = Partial<Pick<WithSpringConfig, 'velocity' | 'reduceMotion' | 'energyThreshold'>>;
11
- export declare const getBottomSheetDialogSpringConfig: (overrides?: BottomSheetDialogSpringOverrides) => WithSpringConfig;
12
2
  /**
13
- * Minimum swipe velocity (px/s) to treat the gesture as a fling for snap/dismiss.
3
+ * The animation duration used for initial render.
14
4
  */
15
- export declare const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY = AnimationDuration.Regularly;
5
+ export declare const DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION = AnimationDuration.Fast;
16
6
  /**
17
- * Fraction of sheet height dragged down before dismiss without a fling.
7
+ * This number represents the swipe speed to meet the velocity threshold.
8
+ */
9
+ export declare const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION = AnimationDuration.Regularly;
10
+ /**
11
+ * This indicates that 60% of the sheet needs to be offscreen to meet the distance threshold.
18
12
  */
19
13
  export declare const DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;
20
- export {};
21
14
  //# sourceMappingURL=BottomSheetDialog.constants.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,yCAAyC;AACrE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAEhE,kFAAkF;AAClF,eAAO,MAAM,uCAAuC;;;;;CAKf,CAAC;AAEtC,KAAK,gCAAgC,GAAG,OAAO,CAC7C,IAAI,CAAC,gBAAgB,EAAE,UAAU,GAAG,cAAc,GAAG,iBAAiB,CAAC,CACxE,CAAC;AAEF,eAAO,MAAM,gCAAgC,eAC/B,gCAAgC,KAC3C,gBAGD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,iDAAiD,8BACjC,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,0CAA0C,MAAM,CAAC"}
1
+ {"version":3,"file":"BottomSheetDialog.constants.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,yCAAyC;AAGrE;;GAEG;AACH,eAAO,MAAM,0CAA0C,yBAC/B,CAAC;AACzB;;GAEG;AACH,eAAO,MAAM,iDAAiD,8BACjC,CAAC;AAC9B;;GAEG;AACH,eAAO,MAAM,0CAA0C,MAAM,CAAC"}
@@ -1,21 +1,15 @@
1
1
  import { AnimationDuration } from "@metamask-previews/design-tokens";
2
- /** iOS-like sheet spring: natural deceleration with minimal overshoot on open. */
3
- export const DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG = {
4
- damping: 28,
5
- stiffness: 320,
6
- mass: 0.9,
7
- overshootClamping: true,
8
- };
9
- export const getBottomSheetDialogSpringConfig = (overrides) => ({
10
- ...DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG,
11
- ...overrides,
12
- });
2
+ // Defaults
13
3
  /**
14
- * Minimum swipe velocity (px/s) to treat the gesture as a fling for snap/dismiss.
4
+ * The animation duration used for initial render.
15
5
  */
16
- export const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY = AnimationDuration.Regularly;
6
+ export const DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION = AnimationDuration.Fast;
17
7
  /**
18
- * Fraction of sheet height dragged down before dismiss without a fling.
8
+ * This number represents the swipe speed to meet the velocity threshold.
9
+ */
10
+ export const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION = AnimationDuration.Regularly;
11
+ /**
12
+ * This indicates that 60% of the sheet needs to be offscreen to meet the distance threshold.
19
13
  */
20
14
  export const DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;
21
15
  //# sourceMappingURL=BottomSheetDialog.constants.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.constants.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,yCAAyC;AAGrE,kFAAkF;AAClF,MAAM,CAAC,MAAM,uCAAuC,GAAG;IACrD,OAAO,EAAE,EAAE;IACX,SAAS,EAAE,GAAG;IACd,IAAI,EAAE,GAAG;IACT,iBAAiB,EAAE,IAAI;CACY,CAAC;AAMtC,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAC9C,SAA4C,EAC1B,EAAE,CAAC,CAAC;IACtB,GAAG,uCAAuC;IAC1C,GAAG,SAAS;CACb,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,CAAC,MAAM,iDAAiD,GAC5D,iBAAiB,CAAC,SAAS,CAAC;AAE9B;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,GAAG,CAAC","sourcesContent":["import { AnimationDuration } from '@metamask-previews/design-tokens';\nimport type { WithSpringConfig } from 'react-native-reanimated';\n\n/** iOS-like sheet spring: natural deceleration with minimal overshoot on open. */\nexport const DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG = {\n damping: 28,\n stiffness: 320,\n mass: 0.9,\n overshootClamping: true,\n} as const satisfies WithSpringConfig;\n\ntype BottomSheetDialogSpringOverrides = Partial<\n Pick<WithSpringConfig, 'velocity' | 'reduceMotion' | 'energyThreshold'>\n>;\n\nexport const getBottomSheetDialogSpringConfig = (\n overrides?: BottomSheetDialogSpringOverrides,\n): WithSpringConfig => ({\n ...DEFAULT_BOTTOMSHEETDIALOG_SPRING_CONFIG,\n ...overrides,\n});\n\n/**\n * Minimum swipe velocity (px/s) to treat the gesture as a fling for snap/dismiss.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_VELOCITY =\n AnimationDuration.Regularly;\n\n/**\n * Fraction of sheet height dragged down before dismiss without a fling.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;\n"]}
1
+ {"version":3,"file":"BottomSheetDialog.constants.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,yCAAyC;AAErE,WAAW;AACX;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GACrD,iBAAiB,CAAC,IAAI,CAAC;AACzB;;GAEG;AACH,MAAM,CAAC,MAAM,iDAAiD,GAC5D,iBAAiB,CAAC,SAAS,CAAC;AAC9B;;GAEG;AACH,MAAM,CAAC,MAAM,0CAA0C,GAAG,GAAG,CAAC","sourcesContent":["import { AnimationDuration } from '@metamask-previews/design-tokens';\n\n// Defaults\n/**\n * The animation duration used for initial render.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_DISPLAY_DURATION =\n AnimationDuration.Fast;\n/**\n * This number represents the swipe speed to meet the velocity threshold.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_SWIPETHRESHOLD_DURATION =\n AnimationDuration.Regularly;\n/**\n * This indicates that 60% of the sheet needs to be offscreen to meet the distance threshold.\n */\nexport const DEFAULT_BOTTOMSHEETDIALOG_DISMISSTHRESHOLD = 0.6;\n"]}
@@ -5,7 +5,6 @@ export declare const BottomSheetDialog: React.ForwardRefExoticComponent<{
5
5
  isFullscreen?: boolean | undefined;
6
6
  isInteractable?: boolean | undefined;
7
7
  keyboardAvoidingViewEnabled?: boolean | undefined;
8
- onDismissStart?: (() => void) | undefined;
9
8
  onClose?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
10
9
  onOpen?: ((hasPendingAction?: boolean | undefined) => void) | undefined;
11
10
  twClassName?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AAyBf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,eAAO,MAAM,iBAAiB;;;;;;;;;iFAoR7B,CAAC"}
1
+ {"version":3,"file":"BottomSheetDialog.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAQA,OAAO,KAON,cAAc;AAyBf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,eAAO,MAAM,iBAAiB;;;;;;;;iFAqR7B,CAAC"}