@metamask-previews/design-system-react-native 0.26.0-preview.047f96c → 0.27.0-preview.a0fe3894

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 (185) hide show
  1. package/CHANGELOG.md +24 -1
  2. package/dist/components/BottomSheet/BottomSheet.cjs +3 -0
  3. package/dist/components/BottomSheet/BottomSheet.cjs.map +1 -1
  4. package/dist/components/BottomSheet/BottomSheet.d.cts.map +1 -1
  5. package/dist/components/BottomSheet/BottomSheet.d.mts.map +1 -1
  6. package/dist/components/BottomSheet/BottomSheet.mjs +3 -0
  7. package/dist/components/BottomSheet/BottomSheet.mjs.map +1 -1
  8. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs +1 -1
  9. package/dist/components/BottomSheetDialog/BottomSheetDialog.cjs.map +1 -1
  10. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.cts.map +1 -1
  11. package/dist/components/BottomSheetDialog/BottomSheetDialog.d.mts.map +1 -1
  12. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs +1 -1
  13. package/dist/components/BottomSheetDialog/BottomSheetDialog.mjs.map +1 -1
  14. package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs +2 -6
  15. package/dist/components/BottomSheetHeader/BottomSheetHeader.cjs.map +1 -1
  16. package/dist/components/BottomSheetHeader/BottomSheetHeader.d.cts.map +1 -1
  17. package/dist/components/BottomSheetHeader/BottomSheetHeader.d.mts.map +1 -1
  18. package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs +2 -6
  19. package/dist/components/BottomSheetHeader/BottomSheetHeader.mjs.map +1 -1
  20. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.cjs +0 -11
  21. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.cjs.map +1 -1
  22. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.cts +6 -20
  23. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.cts.map +1 -1
  24. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.mts +6 -20
  25. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.d.mts.map +1 -1
  26. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.mjs +1 -10
  27. package/dist/components/BottomSheetHeader/BottomSheetHeader.types.mjs.map +1 -1
  28. package/dist/components/BottomSheetHeader/index.cjs +1 -3
  29. package/dist/components/BottomSheetHeader/index.cjs.map +1 -1
  30. package/dist/components/BottomSheetHeader/index.d.cts +0 -1
  31. package/dist/components/BottomSheetHeader/index.d.cts.map +1 -1
  32. package/dist/components/BottomSheetHeader/index.d.mts +0 -1
  33. package/dist/components/BottomSheetHeader/index.d.mts.map +1 -1
  34. package/dist/components/BottomSheetHeader/index.mjs +0 -1
  35. package/dist/components/BottomSheetHeader/index.mjs.map +1 -1
  36. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs +1 -1
  37. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.cjs.map +1 -1
  38. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.cts.map +1 -1
  39. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.d.mts.map +1 -1
  40. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs +3 -3
  41. package/dist/components/BottomSheetOverlay/BottomSheetOverlay.mjs.map +1 -1
  42. package/dist/components/Content/Content.cjs +71 -0
  43. package/dist/components/Content/Content.cjs.map +1 -0
  44. package/dist/components/Content/Content.constants.cjs +9 -0
  45. package/dist/components/Content/Content.constants.cjs.map +1 -0
  46. package/dist/components/Content/Content.constants.d.cts +3 -0
  47. package/dist/components/Content/Content.constants.d.cts.map +1 -0
  48. package/dist/components/Content/Content.constants.d.mts +3 -0
  49. package/dist/components/Content/Content.constants.d.mts.map +1 -0
  50. package/dist/components/Content/Content.constants.mjs +6 -0
  51. package/dist/components/Content/Content.constants.mjs.map +1 -0
  52. package/dist/components/Content/Content.d.cts +4 -0
  53. package/dist/components/Content/Content.d.cts.map +1 -0
  54. package/dist/components/Content/Content.d.mts +4 -0
  55. package/dist/components/Content/Content.d.mts.map +1 -0
  56. package/dist/components/Content/Content.mjs +71 -0
  57. package/dist/components/Content/Content.mjs.map +1 -0
  58. package/dist/components/Content/Content.types.cjs +3 -0
  59. package/dist/components/Content/Content.types.cjs.map +1 -0
  60. package/dist/components/Content/Content.types.d.cts +31 -0
  61. package/dist/components/Content/Content.types.d.cts.map +1 -0
  62. package/dist/components/Content/Content.types.d.mts +31 -0
  63. package/dist/components/Content/Content.types.d.mts.map +1 -0
  64. package/dist/components/Content/Content.types.mjs +2 -0
  65. package/dist/components/Content/Content.types.mjs.map +1 -0
  66. package/dist/components/Content/index.cjs +8 -0
  67. package/dist/components/Content/index.cjs.map +1 -0
  68. package/dist/components/Content/index.d.cts +4 -0
  69. package/dist/components/Content/index.d.cts.map +1 -0
  70. package/dist/components/Content/index.d.mts +4 -0
  71. package/dist/components/Content/index.d.mts.map +1 -0
  72. package/dist/components/Content/index.mjs +3 -0
  73. package/dist/components/Content/index.mjs.map +1 -0
  74. package/dist/components/HeaderBase/HeaderBase.cjs +93 -72
  75. package/dist/components/HeaderBase/HeaderBase.cjs.map +1 -1
  76. package/dist/components/HeaderBase/HeaderBase.d.cts.map +1 -1
  77. package/dist/components/HeaderBase/HeaderBase.d.mts.map +1 -1
  78. package/dist/components/HeaderBase/HeaderBase.mjs +93 -72
  79. package/dist/components/HeaderBase/HeaderBase.mjs.map +1 -1
  80. package/dist/components/HeaderBase/HeaderBase.types.cjs +0 -12
  81. package/dist/components/HeaderBase/HeaderBase.types.cjs.map +1 -1
  82. package/dist/components/HeaderBase/HeaderBase.types.d.cts +11 -19
  83. package/dist/components/HeaderBase/HeaderBase.types.d.cts.map +1 -1
  84. package/dist/components/HeaderBase/HeaderBase.types.d.mts +11 -19
  85. package/dist/components/HeaderBase/HeaderBase.types.d.mts.map +1 -1
  86. package/dist/components/HeaderBase/HeaderBase.types.mjs +1 -11
  87. package/dist/components/HeaderBase/HeaderBase.types.mjs.map +1 -1
  88. package/dist/components/HeaderBase/index.cjs +1 -3
  89. package/dist/components/HeaderBase/index.cjs.map +1 -1
  90. package/dist/components/HeaderBase/index.d.cts +0 -1
  91. package/dist/components/HeaderBase/index.d.cts.map +1 -1
  92. package/dist/components/HeaderBase/index.d.mts +0 -1
  93. package/dist/components/HeaderBase/index.d.mts.map +1 -1
  94. package/dist/components/HeaderBase/index.mjs +0 -1
  95. package/dist/components/HeaderBase/index.mjs.map +1 -1
  96. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.cjs +4 -12
  97. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.cjs.map +1 -1
  98. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.cts +0 -8
  99. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.cts.map +1 -1
  100. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.mts +0 -8
  101. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.d.mts.map +1 -1
  102. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.mjs +3 -10
  103. package/dist/components/HeaderStandardAnimated/useHeaderStandardAnimated.mjs.map +1 -1
  104. package/dist/components/Icon/Icon.assets.cjs +2 -0
  105. package/dist/components/Icon/Icon.assets.cjs.map +1 -1
  106. package/dist/components/Icon/Icon.assets.d.cts.map +1 -1
  107. package/dist/components/Icon/Icon.assets.d.mts.map +1 -1
  108. package/dist/components/Icon/Icon.assets.mjs +2 -0
  109. package/dist/components/Icon/Icon.assets.mjs.map +1 -1
  110. package/dist/components/Icon/Icon.cjs +3 -1
  111. package/dist/components/Icon/Icon.cjs.map +1 -1
  112. package/dist/components/Icon/Icon.d.cts.map +1 -1
  113. package/dist/components/Icon/Icon.d.mts.map +1 -1
  114. package/dist/components/Icon/Icon.mjs +3 -1
  115. package/dist/components/Icon/Icon.mjs.map +1 -1
  116. package/dist/components/Icon/assets/flash-filled.svg +1 -0
  117. package/dist/components/SegmentGroup/SegmentGroup.cjs +4 -6
  118. package/dist/components/SegmentGroup/SegmentGroup.cjs.map +1 -1
  119. package/dist/components/SegmentGroup/SegmentGroup.d.cts.map +1 -1
  120. package/dist/components/SegmentGroup/SegmentGroup.d.mts.map +1 -1
  121. package/dist/components/SegmentGroup/SegmentGroup.mjs +5 -7
  122. package/dist/components/SegmentGroup/SegmentGroup.mjs.map +1 -1
  123. package/dist/components/TextArea/TextArea.d.cts +2 -2
  124. package/dist/components/TextArea/TextArea.d.mts +2 -2
  125. package/dist/components/TextField/TextField.d.cts +2 -2
  126. package/dist/components/TextField/TextField.d.mts +2 -2
  127. package/dist/components/TextFieldSearch/TextFieldSearch.d.cts +2 -2
  128. package/dist/components/TextFieldSearch/TextFieldSearch.d.mts +2 -2
  129. package/dist/components/Toast/Toast.constants.cjs +4 -7
  130. package/dist/components/Toast/Toast.constants.cjs.map +1 -1
  131. package/dist/components/Toast/Toast.constants.d.cts +1 -6
  132. package/dist/components/Toast/Toast.constants.d.cts.map +1 -1
  133. package/dist/components/Toast/Toast.constants.d.mts +1 -6
  134. package/dist/components/Toast/Toast.constants.d.mts.map +1 -1
  135. package/dist/components/Toast/Toast.constants.mjs +1 -6
  136. package/dist/components/Toast/Toast.constants.mjs.map +1 -1
  137. package/dist/components/Toast/Toast.types.cjs +2 -10
  138. package/dist/components/Toast/Toast.types.cjs.map +1 -1
  139. package/dist/components/Toast/Toast.types.d.cts +4 -11
  140. package/dist/components/Toast/Toast.types.d.cts.map +1 -1
  141. package/dist/components/Toast/Toast.types.d.mts +4 -11
  142. package/dist/components/Toast/Toast.types.d.mts.map +1 -1
  143. package/dist/components/Toast/Toast.types.mjs +2 -10
  144. package/dist/components/Toast/Toast.types.mjs.map +1 -1
  145. package/dist/components/Toast/index.cjs +3 -5
  146. package/dist/components/Toast/index.cjs.map +1 -1
  147. package/dist/components/Toast/index.d.cts +2 -2
  148. package/dist/components/Toast/index.d.cts.map +1 -1
  149. package/dist/components/Toast/index.d.mts +2 -2
  150. package/dist/components/Toast/index.d.mts.map +1 -1
  151. package/dist/components/Toast/index.mjs +2 -2
  152. package/dist/components/Toast/index.mjs.map +1 -1
  153. package/dist/components/index.cjs +5 -4
  154. package/dist/components/index.cjs.map +1 -1
  155. package/dist/components/index.d.cts +4 -2
  156. package/dist/components/index.d.cts.map +1 -1
  157. package/dist/components/index.d.mts +4 -2
  158. package/dist/components/index.d.mts.map +1 -1
  159. package/dist/components/index.mjs +3 -2
  160. package/dist/components/index.mjs.map +1 -1
  161. package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.cjs +1 -1
  162. package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.cjs.map +1 -1
  163. package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.mjs +1 -1
  164. package/dist/components/temp-components/ButtonAnimated/ButtonAnimated.mjs.map +1 -1
  165. package/dist/components/temp-components/Spinner/Spinner.cjs +1 -1
  166. package/dist/components/temp-components/Spinner/Spinner.cjs.map +1 -1
  167. package/dist/components/temp-components/Spinner/Spinner.mjs +1 -1
  168. package/dist/components/temp-components/Spinner/Spinner.mjs.map +1 -1
  169. package/package.json +4 -4
  170. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.cjs +0 -15
  171. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.cjs.map +0 -1
  172. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.cts +0 -7
  173. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.cts.map +0 -1
  174. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.mts +0 -7
  175. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.d.mts.map +0 -1
  176. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.mjs +0 -12
  177. package/dist/components/BottomSheetHeader/BottomSheetHeader.constants.mjs.map +0 -1
  178. package/dist/components/HeaderBase/HeaderBase.constants.cjs +0 -15
  179. package/dist/components/HeaderBase/HeaderBase.constants.cjs.map +0 -1
  180. package/dist/components/HeaderBase/HeaderBase.constants.d.cts +0 -7
  181. package/dist/components/HeaderBase/HeaderBase.constants.d.cts.map +0 -1
  182. package/dist/components/HeaderBase/HeaderBase.constants.d.mts +0 -7
  183. package/dist/components/HeaderBase/HeaderBase.constants.d.mts.map +0 -1
  184. package/dist/components/HeaderBase/HeaderBase.constants.mjs +0 -12
  185. package/dist/components/HeaderBase/HeaderBase.constants.mjs.map +0 -1
package/CHANGELOG.md CHANGED
@@ -7,6 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.27.0]
11
+
12
+ ### Added
13
+
14
+ - Added `FlashFilled` icon (filled lightning bolt) to `IconName` ([#1191](https://github.com/MetaMask/metamask-design-system/pull/1191))
15
+ - Added `SelectButtonSize` so `SelectButton` exposes a semantic size type ([#1177](https://github.com/MetaMask/metamask-design-system/pull/1177))
16
+
17
+ ### Changed
18
+
19
+ - **BREAKING:** Removed `panGestureHandlerProps` from `BottomSheet` and `BottomSheetDialog` following the migration to the `react-native-gesture-handler` v2 `GestureDetector`/`Gesture.Pan()` API ([#1165](https://github.com/MetaMask/metamask-design-system/pull/1165))
20
+ - See [Migration Guide](./MIGRATION.md#from-version-0260-to-0270)
21
+ - **BREAKING:** Removed the variant-based title API from `HeaderBase` and `BottomSheetHeader` ([#1103](https://github.com/MetaMask/metamask-design-system/pull/1103))
22
+ - Removed `variant`, `HeaderBaseVariant`, and `BottomSheetHeaderVariant`, plus `HeaderBase`'s `titleTestID`
23
+ - String titles now render with a centered `HeadingSm` treatment; pass custom `children` for bespoke title layouts and use `textProps.testID` in place of `titleTestID`
24
+ - See [Migration Guide](./MIGRATION.md#from-version-0260-to-0270)
25
+ - Reduced the default `SegmentGroup` segment spacing from `gap-3` to `gap-1` for tighter grouped segments ([#1194](https://github.com/MetaMask/metamask-design-system/pull/1194))
26
+
27
+ ### Fixed
28
+
29
+ - Fixed a `HeaderStandardAnimated` runtime crash under React Native Reanimated 4 by inlining the scroll-handler worklet ([#1185](https://github.com/MetaMask/metamask-design-system/pull/1185))
30
+ - Fixed React Native Web rendering for `BottomSheet`, `BottomSheetOverlay`, `Icon`, and the animated `ButtonAnimated` and `Spinner` components ([#1187](https://github.com/MetaMask/metamask-design-system/pull/1187))
31
+
10
32
  ## [0.26.0]
11
33
 
12
34
  ### Added
@@ -446,7 +468,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
446
468
  - Full TypeScript support with type definitions and enums
447
469
  - React Native integration with TWRNC preset support
448
470
 
449
- [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react-native@0.26.0...HEAD
471
+ [Unreleased]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react-native@0.27.0...HEAD
472
+ [0.27.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react-native@0.26.0...@metamask/design-system-react-native@0.27.0
450
473
  [0.26.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react-native@0.25.0...@metamask/design-system-react-native@0.26.0
451
474
  [0.25.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react-native@0.24.0...@metamask/design-system-react-native@0.25.0
452
475
  [0.24.0]: https://github.com/MetaMask/metamask-design-system/compare/@metamask/design-system-react-native@0.23.0...@metamask/design-system-react-native@0.24.0
@@ -65,6 +65,9 @@ exports.BottomSheet = (0, react_1.forwardRef)(({ children, onClose, onOpen, goBa
65
65
  }, [goBack, onClose]);
66
66
  // Dismiss the sheet when Android back button is pressed.
67
67
  (0, react_1.useEffect)(() => {
68
+ if (react_native_1.Platform.OS !== 'android') {
69
+ return undefined;
70
+ }
68
71
  const hardwareBackPress = () => {
69
72
  if (isInteractable) {
70
73
  bottomSheetDialogRef.current?.onCloseDialog();
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheet.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;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AAC,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 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 = 'BottomShe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AS,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"]}
@@ -1 +1 @@
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;;;;;;;;;;;2EAyHvB,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"}
@@ -1 +1 @@
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;;;;;;;;;;;2EAyHvB,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"}
@@ -46,6 +46,9 @@ export const BottomSheet = forwardRef(({ children, onClose, onOpen, goBack, styl
46
46
  }, [goBack, onClose]);
47
47
  // Dismiss the sheet when Android back button is pressed.
48
48
  useEffect(() => {
49
+ if (Platform.OS !== 'android') {
50
+ return undefined;
51
+ }
49
52
  const hardwareBackPress = () => {
50
53
  if (isInteractable) {
51
54
  bottomSheetDialogRef.current?.onCloseDialog();
@@ -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;AAQ9E,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,kBAAkB,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,MAAM,CAAC,KAAK,CAAC,CA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,CACzD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,kBAAkB,CACjB,OAAO,CAAC,CACN,cAAc;YACZ,CAAC,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE;YACrD,CAAC,CAAC,SAAS,CACd,EAEH;QAAA,CAAC,iBAAiB,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,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 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"]}
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;AAQ9E,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,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,OAAO,CACL,CAAC,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,OAAO,CAAC,CACN,cAAc;YACZ,CAAC,CAAC,GAAG,EAAE,CAAC,oBAAoB,CAAC,OAAO,EAAE,aAAa,EAAE;YACrD,CAAC,CAAC,SAAS,CACd,EAEH;QAAA,CAAC,iBAAiB,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,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"]}
@@ -175,7 +175,7 @@ exports.BottomSheetDialog = (0, react_1.forwardRef)(({ children, isFullscreen =
175
175
  translateY: currentYOffset.value,
176
176
  },
177
177
  ],
178
- }));
178
+ }), []);
179
179
  const sheetStyle = (0, react_1.useMemo)(() => [
180
180
  tw.style('bg-default rounded-t-3xl overflow-hidden border border-muted', twClassName),
181
181
  {
@@ -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;A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D,sBAAsB,CAAC,CACrB,uBAAQ,CAAC,EAAE,KAAK,KAAK,CAAC,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,MAAM,CACtD,CACD,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,8CAAe,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CACvC;UAAA,CAAC,iCAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAE1B;YAAA,CAAC,cAAc,IAAI,CACjB,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,mBAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,mBAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,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 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 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 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 const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\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 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 transform: [\n {\n translateY: currentYOffset.value,\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,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,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,OA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AqC,CAAC,CAAC,EAC/D;cAAA,EAAE,mBAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,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 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 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 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 const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\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 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 '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 +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;;;;;;;;iFAkQ7B,CAAC"}
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;;;;;;;;iFAqQ7B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AAyBf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,eAAO,MAAM,iBAAiB;;;;;;;;iFAkQ7B,CAAC"}
1
+ {"version":3,"file":"BottomSheetDialog.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":"AAOA,OAAO,KAON,cAAc;AAyBf,OAAO,KAAK,EACV,oBAAoB,EAErB,sCAAkC;AAEnC,eAAO,MAAM,iBAAiB;;;;;;;;iFAqQ7B,CAAC"}
@@ -157,7 +157,7 @@ export const BottomSheetDialog = forwardRef(({ children, isFullscreen = false, i
157
157
  translateY: currentYOffset.value,
158
158
  },
159
159
  ],
160
- }));
160
+ }), []);
161
161
  const sheetStyle = useMemo(() => [
162
162
  tw.style('bg-default rounded-t-3xl overflow-hidden border border-muted', twClassName),
163
163
  {
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetDialog.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,KAAK,EACL,WAAW,EACX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d,CAAC,CAAC,CAAC;IAEJ,OAAO,CACL,CAAC,oBAAoB,CACnB,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAC/C,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,OAAO,CAAC,CAAC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CACvC;UAAA,CAAC,QAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAE1B;YAAA,CAAC,cAAc,IAAI,CACjB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,IAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,eAAe,CACnB;MAAA,EAAE,oBAAoB,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 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 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 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 const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\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 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 transform: [\n {\n translateY: currentYOffset.value,\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.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetDialog/BottomSheetDialog.tsx"],"names":[],"mappings":";;;;;;AAAA,OAAO,EACL,KAAK,EACL,WAAW,EACX,QAAQ,EACT,sDAAsD;AACvD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,yCAAyC;;;AAEzE,OAAO,QAAO,EACZ,UAAU,EACV,WAAW,EACX,SAAS,EACT,OAAO,EACP,MAAM,EACN,mBAAmB,EACpB,cAAc;;AACf,OAAO,EAEL,IAAI,EACJ,QAAQ,EACR,oBAAoB,EACrB,qBAAqB;AACtB,OAAO,EAAE,OAAO,EAAE,eAAe,EAAE,qCAAqC;AACxE,OAAO,QAAQ,EAAE,EACf,OAAO,EACP,gBAAgB,EAChB,cAAc,EACd,UAAU,EACX,gCAAgC;AACjC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AC,2BAA2B,CAAC,CACrC,IAAI,KAAK,CAAC,CAEV;QAAA,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,cAAc,CAAC,CACvC;UAAA,CAAC,QAAQ,CAAC,IAAI,CACZ,QAAQ,CAAC,CAAC,iBAAiB,CAAC,CAC5B,KAAK,CAAC,CAAC,kBAAkB,CAAC,CAE1B;YAAA,CAAC,cAAc,IAAI,CACjB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC,CACrD;gBAAA,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,qCAAqC,CAAC,CAAC,EAC/D;cAAA,EAAE,IAAI,CAAC,CACR,CACD;YAAA,CAAC,QAAQ,CACX;UAAA,EAAE,QAAQ,CAAC,IAAI,CACjB;QAAA,EAAE,eAAe,CACnB;MAAA,EAAE,oBAAoB,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 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 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 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 const gesture = Gesture.Pan()\n .enabled(isInteractable)\n .onStart(() => {\n // Starts tracking vertical position of gesture.\n gestureStartYOffset.value = currentYOffset.value;\n })\n .onUpdate((event) => {\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 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 '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"]}
@@ -11,15 +11,11 @@ const react_1 = __importDefault(require("react"));
11
11
  const ButtonIcon_1 = require("../ButtonIcon/index.cjs");
12
12
  const HeaderBase_1 = require("../HeaderBase/index.cjs");
13
13
  const Icon_1 = require("../Icon/index.cjs");
14
- // Internal dependencies.
15
- const BottomSheetHeader_constants_1 = require("./BottomSheetHeader.constants.cjs");
16
- const BottomSheetHeader_types_1 = require("./BottomSheetHeader.types.cjs");
17
- const BottomSheetHeader = ({ style, twClassName, children, onBack, backButtonProps, onClose, closeButtonProps, variant = BottomSheetHeader_types_1.BottomSheetHeaderVariant.Compact, ...props }) => {
14
+ const BottomSheetHeader = ({ style, twClassName, children, onBack, backButtonProps, onClose, closeButtonProps, ...props }) => {
18
15
  const tw = (0, design_system_twrnc_preset_1.useTailwind)();
19
16
  const startAccessory = onBack ? (<ButtonIcon_1.ButtonIcon iconName={Icon_1.IconName.ArrowLeft} onPress={onBack} size={ButtonIcon_1.ButtonIconSize.Md} {...backButtonProps}/>) : undefined;
20
17
  const endAccessory = onClose ? (<ButtonIcon_1.ButtonIcon iconName={Icon_1.IconName.Close} onPress={onClose} size={ButtonIcon_1.ButtonIconSize.Md} {...closeButtonProps}/>) : undefined;
21
- const headerBaseVariant = BottomSheetHeader_constants_1.BOTTOM_SHEET_HEADER_VARIANT_MAP[variant];
22
- return (<HeaderBase_1.HeaderBase {...props} style={[tw.style('px-4', twClassName), style]} startAccessory={startAccessory} endAccessory={endAccessory} variant={headerBaseVariant}>
18
+ return (<HeaderBase_1.HeaderBase {...props} style={[tw.style('px-4', twClassName), style]} startAccessory={startAccessory} endAccessory={endAccessory}>
23
19
  {children}
24
20
  </HeaderBase_1.HeaderBase>);
25
21
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,8FAA4E;AAC5E,kDAA0B;AAE1B,yBAAyB;AACzB,wDAA2D;AAC3D,wDAA2C;AAC3C,4CAAmC;AAEnC,yBAAyB;AACzB,mFAAgF;AAEhF,2EAAqE;AAE9D,MAAM,iBAAiB,GAAqC,CAAC,EAClE,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,OAAO,GAAG,kDAAwB,CAAC,OAAO,EAC1C,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IAEzB,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAC9B,CAAC,uBAAU,CACT,QAAQ,CAAC,CAAC,eAAQ,CAAC,SAAS,CAAC,CAC7B,OAAO,CAAC,CAAC,MAAM,CAAC,CAChB,IAAI,CAAC,CAAC,2BAAc,CAAC,EAAE,CAAC,CACxB,IAAI,eAAe,CAAC,EACpB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAC7B,CAAC,uBAAU,CACT,QAAQ,CAAC,CAAC,eAAQ,CAAC,KAAK,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,CAAC,CAAC,2BAAc,CAAC,EAAE,CAAC,CACxB,IAAI,gBAAgB,CAAC,EACrB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,iBAAiB,GAAG,6DAA+B,CAAC,OAAO,CAAC,CAAC;IAEnE,OAAO,CACL,CAAC,uBAAU,CACT,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,CAC9C,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAE3B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,uBAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC;AA5CW,QAAA,iBAAiB,qBA4C5B","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { HeaderBase } from '../HeaderBase';\nimport { IconName } from '../Icon';\n\n// Internal dependencies.\nimport { BOTTOM_SHEET_HEADER_VARIANT_MAP } from './BottomSheetHeader.constants';\nimport type { BottomSheetHeaderProps } from './BottomSheetHeader.types';\nimport { BottomSheetHeaderVariant } from './BottomSheetHeader.types';\n\nexport const BottomSheetHeader: React.FC<BottomSheetHeaderProps> = ({\n style,\n twClassName,\n children,\n onBack,\n backButtonProps,\n onClose,\n closeButtonProps,\n variant = BottomSheetHeaderVariant.Compact,\n ...props\n}) => {\n const tw = useTailwind();\n\n const startAccessory = onBack ? (\n <ButtonIcon\n iconName={IconName.ArrowLeft}\n onPress={onBack}\n size={ButtonIconSize.Md}\n {...backButtonProps}\n />\n ) : undefined;\n\n const endAccessory = onClose ? (\n <ButtonIcon\n iconName={IconName.Close}\n onPress={onClose}\n size={ButtonIconSize.Md}\n {...closeButtonProps}\n />\n ) : undefined;\n\n const headerBaseVariant = BOTTOM_SHEET_HEADER_VARIANT_MAP[variant];\n\n return (\n <HeaderBase\n {...props}\n style={[tw.style('px-4', twClassName), style]}\n startAccessory={startAccessory}\n endAccessory={endAccessory}\n variant={headerBaseVariant}\n >\n {children}\n </HeaderBase>\n );\n};\n"]}
1
+ {"version":3,"file":"BottomSheetHeader.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,8FAA4E;AAC5E,kDAA0B;AAE1B,yBAAyB;AACzB,wDAA2D;AAC3D,wDAA2C;AAC3C,4CAAmC;AAI5B,MAAM,iBAAiB,GAAqC,CAAC,EAClE,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,IAAA,wCAAW,GAAE,CAAC;IAEzB,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAC9B,CAAC,uBAAU,CACT,QAAQ,CAAC,CAAC,eAAQ,CAAC,SAAS,CAAC,CAC7B,OAAO,CAAC,CAAC,MAAM,CAAC,CAChB,IAAI,CAAC,CAAC,2BAAc,CAAC,EAAE,CAAC,CACxB,IAAI,eAAe,CAAC,EACpB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAC7B,CAAC,uBAAU,CACT,QAAQ,CAAC,CAAC,eAAQ,CAAC,KAAK,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,CAAC,CAAC,2BAAc,CAAC,EAAE,CAAC,CACxB,IAAI,gBAAgB,CAAC,EACrB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,CACL,CAAC,uBAAU,CACT,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,CAC9C,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,YAAY,CAAC,CAAC,YAAY,CAAC,CAE3B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,uBAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC;AAvCW,QAAA,iBAAiB,qBAuC5B","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { HeaderBase } from '../HeaderBase';\nimport { IconName } from '../Icon';\n\nimport type { BottomSheetHeaderProps } from './BottomSheetHeader.types';\n\nexport const BottomSheetHeader: React.FC<BottomSheetHeaderProps> = ({\n style,\n twClassName,\n children,\n onBack,\n backButtonProps,\n onClose,\n closeButtonProps,\n ...props\n}) => {\n const tw = useTailwind();\n\n const startAccessory = onBack ? (\n <ButtonIcon\n iconName={IconName.ArrowLeft}\n onPress={onBack}\n size={ButtonIconSize.Md}\n {...backButtonProps}\n />\n ) : undefined;\n\n const endAccessory = onClose ? (\n <ButtonIcon\n iconName={IconName.Close}\n onPress={onClose}\n size={ButtonIconSize.Md}\n {...closeButtonProps}\n />\n ) : undefined;\n return (\n <HeaderBase\n {...props}\n style={[tw.style('px-4', twClassName), style]}\n startAccessory={startAccessory}\n endAccessory={endAccessory}\n >\n {children}\n </HeaderBase>\n );\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAS1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,sCAAkC;AAGxE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4C9D,CAAC"}
1
+ {"version":3,"file":"BottomSheetHeader.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,sCAAkC;AAExE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAuC9D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAS1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,sCAAkC;AAGxE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CA4C9D,CAAC"}
1
+ {"version":3,"file":"BottomSheetHeader.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,cAAc;AAO1B,OAAO,KAAK,EAAE,sBAAsB,EAAE,sCAAkC;AAExE,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAuC9D,CAAC"}
@@ -12,15 +12,11 @@ const React = $importDefault($React);
12
12
  import { ButtonIcon, ButtonIconSize } from "../ButtonIcon/index.mjs";
13
13
  import { HeaderBase } from "../HeaderBase/index.mjs";
14
14
  import { IconName } from "../Icon/index.mjs";
15
- // Internal dependencies.
16
- import { BOTTOM_SHEET_HEADER_VARIANT_MAP } from "./BottomSheetHeader.constants.mjs";
17
- import { BottomSheetHeaderVariant } from "./BottomSheetHeader.types.mjs";
18
- export const BottomSheetHeader = ({ style, twClassName, children, onBack, backButtonProps, onClose, closeButtonProps, variant = BottomSheetHeaderVariant.Compact, ...props }) => {
15
+ export const BottomSheetHeader = ({ style, twClassName, children, onBack, backButtonProps, onClose, closeButtonProps, ...props }) => {
19
16
  const tw = useTailwind();
20
17
  const startAccessory = onBack ? (<ButtonIcon iconName={IconName.ArrowLeft} onPress={onBack} size={ButtonIconSize.Md} {...backButtonProps}/>) : undefined;
21
18
  const endAccessory = onClose ? (<ButtonIcon iconName={IconName.Close} onPress={onClose} size={ButtonIconSize.Md} {...closeButtonProps}/>) : undefined;
22
- const headerBaseVariant = BOTTOM_SHEET_HEADER_VARIANT_MAP[variant];
23
- return (<HeaderBase {...props} style={[tw.style('px-4', twClassName), style]} startAccessory={startAccessory} endAccessory={endAccessory} variant={headerBaseVariant}>
19
+ return (<HeaderBase {...props} style={[tw.style('px-4', twClassName), style]} startAccessory={startAccessory} endAccessory={endAccessory}>
24
20
  {children}
25
21
  </HeaderBase>);
26
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAE1B,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gCAAsB;AAC3D,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,QAAQ,EAAE,0BAAgB;AAEnC,yBAAyB;AACzB,OAAO,EAAE,+BAA+B,EAAE,0CAAsC;AAEhF,OAAO,EAAE,wBAAwB,EAAE,sCAAkC;AAErE,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,OAAO,GAAG,wBAAwB,CAAC,OAAO,EAC1C,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAC9B,CAAC,UAAU,CACT,QAAQ,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC7B,OAAO,CAAC,CAAC,MAAM,CAAC,CAChB,IAAI,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CACxB,IAAI,eAAe,CAAC,EACpB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAC7B,CAAC,UAAU,CACT,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CACxB,IAAI,gBAAgB,CAAC,EACrB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,iBAAiB,GAAG,+BAA+B,CAAC,OAAO,CAAC,CAAC;IAEnE,OAAO,CACL,CAAC,UAAU,CACT,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,CAC9C,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,YAAY,CAAC,CAAC,YAAY,CAAC,CAC3B,OAAO,CAAC,CAAC,iBAAiB,CAAC,CAE3B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { HeaderBase } from '../HeaderBase';\nimport { IconName } from '../Icon';\n\n// Internal dependencies.\nimport { BOTTOM_SHEET_HEADER_VARIANT_MAP } from './BottomSheetHeader.constants';\nimport type { BottomSheetHeaderProps } from './BottomSheetHeader.types';\nimport { BottomSheetHeaderVariant } from './BottomSheetHeader.types';\n\nexport const BottomSheetHeader: React.FC<BottomSheetHeaderProps> = ({\n style,\n twClassName,\n children,\n onBack,\n backButtonProps,\n onClose,\n closeButtonProps,\n variant = BottomSheetHeaderVariant.Compact,\n ...props\n}) => {\n const tw = useTailwind();\n\n const startAccessory = onBack ? (\n <ButtonIcon\n iconName={IconName.ArrowLeft}\n onPress={onBack}\n size={ButtonIconSize.Md}\n {...backButtonProps}\n />\n ) : undefined;\n\n const endAccessory = onClose ? (\n <ButtonIcon\n iconName={IconName.Close}\n onPress={onClose}\n size={ButtonIconSize.Md}\n {...closeButtonProps}\n />\n ) : undefined;\n\n const headerBaseVariant = BOTTOM_SHEET_HEADER_VARIANT_MAP[variant];\n\n return (\n <HeaderBase\n {...props}\n style={[tw.style('px-4', twClassName), style]}\n startAccessory={startAccessory}\n endAccessory={endAccessory}\n variant={headerBaseVariant}\n >\n {children}\n </HeaderBase>\n );\n};\n"]}
1
+ {"version":3,"file":"BottomSheetHeader.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.tsx"],"names":[],"mappings":";;;;;;AAAA,4BAA4B;AAC5B,OAAO,EAAE,WAAW,EAAE,sDAAsD;AAC5E,OAAO,MAAK,cAAc;;AAE1B,yBAAyB;AACzB,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,gCAAsB;AAC3D,OAAO,EAAE,UAAU,EAAE,gCAAsB;AAC3C,OAAO,EAAE,QAAQ,EAAE,0BAAgB;AAInC,MAAM,CAAC,MAAM,iBAAiB,GAAqC,CAAC,EAClE,KAAK,EACL,WAAW,EACX,QAAQ,EACR,MAAM,EACN,eAAe,EACf,OAAO,EACP,gBAAgB,EAChB,GAAG,KAAK,EACT,EAAE,EAAE;IACH,MAAM,EAAE,GAAG,WAAW,EAAE,CAAC;IAEzB,MAAM,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC,CAC9B,CAAC,UAAU,CACT,QAAQ,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,CAC7B,OAAO,CAAC,CAAC,MAAM,CAAC,CAChB,IAAI,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CACxB,IAAI,eAAe,CAAC,EACpB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IAEd,MAAM,YAAY,GAAG,OAAO,CAAC,CAAC,CAAC,CAC7B,CAAC,UAAU,CACT,QAAQ,CAAC,CAAC,QAAQ,CAAC,KAAK,CAAC,CACzB,OAAO,CAAC,CAAC,OAAO,CAAC,CACjB,IAAI,CAAC,CAAC,cAAc,CAAC,EAAE,CAAC,CACxB,IAAI,gBAAgB,CAAC,EACrB,CACH,CAAC,CAAC,CAAC,SAAS,CAAC;IACd,OAAO,CACL,CAAC,UAAU,CACT,IAAI,KAAK,CAAC,CACV,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,CAAC,EAAE,KAAK,CAAC,CAAC,CAC9C,cAAc,CAAC,CAAC,cAAc,CAAC,CAC/B,YAAY,CAAC,CAAC,YAAY,CAAC,CAE3B;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,UAAU,CAAC,CACd,CAAC;AACJ,CAAC,CAAC","sourcesContent":["// Third party dependencies.\nimport { useTailwind } from '@metamask-previews/design-system-twrnc-preset';\nimport React from 'react';\n\n// External dependencies.\nimport { ButtonIcon, ButtonIconSize } from '../ButtonIcon';\nimport { HeaderBase } from '../HeaderBase';\nimport { IconName } from '../Icon';\n\nimport type { BottomSheetHeaderProps } from './BottomSheetHeader.types';\n\nexport const BottomSheetHeader: React.FC<BottomSheetHeaderProps> = ({\n style,\n twClassName,\n children,\n onBack,\n backButtonProps,\n onClose,\n closeButtonProps,\n ...props\n}) => {\n const tw = useTailwind();\n\n const startAccessory = onBack ? (\n <ButtonIcon\n iconName={IconName.ArrowLeft}\n onPress={onBack}\n size={ButtonIconSize.Md}\n {...backButtonProps}\n />\n ) : undefined;\n\n const endAccessory = onClose ? (\n <ButtonIcon\n iconName={IconName.Close}\n onPress={onClose}\n size={ButtonIconSize.Md}\n {...closeButtonProps}\n />\n ) : undefined;\n return (\n <HeaderBase\n {...props}\n style={[tw.style('px-4', twClassName), style]}\n startAccessory={startAccessory}\n endAccessory={endAccessory}\n >\n {children}\n </HeaderBase>\n );\n};\n"]}
@@ -1,14 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BottomSheetHeaderVariant = void 0;
4
- /**
5
- * Variant options for BottomSheetHeader component.
6
- * - Compact: Center-aligned title with HeadingSm text (default)
7
- * - Display: Left-aligned title with HeadingLg text
8
- */
9
- var BottomSheetHeaderVariant;
10
- (function (BottomSheetHeaderVariant) {
11
- BottomSheetHeaderVariant["Display"] = "display";
12
- BottomSheetHeaderVariant["Compact"] = "compact";
13
- })(BottomSheetHeaderVariant || (exports.BottomSheetHeaderVariant = BottomSheetHeaderVariant = {}));
14
3
  //# sourceMappingURL=BottomSheetHeader.types.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.types.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":";;;AAGA;;;;GAIG;AACH,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,+CAAmB,CAAA;IACnB,+CAAmB,CAAA;AACrB,CAAC,EAHW,wBAAwB,wCAAxB,wBAAwB,QAGnC","sourcesContent":["import type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { HeaderBaseProps } from '../HeaderBase/HeaderBase.types';\n\n/**\n * Variant options for BottomSheetHeader component.\n * - Compact: Center-aligned title with HeadingSm text (default)\n * - Display: Left-aligned title with HeadingLg text\n */\nexport enum BottomSheetHeaderVariant {\n Display = 'display',\n Compact = 'compact',\n}\n\n/**\n * BottomSheetHeader component props.\n *\n * Extends HeaderBase's props (which extends ViewProps) to inherit standard\n * props such as `testID`, `accessibilityLabel`, and other View props.\n */\nexport type BottomSheetHeaderProps = {\n /**\n * Callback function triggered when the back button is pressed.\n * When provided, a back arrow ButtonIcon is rendered as the start accessory.\n */\n onBack?: () => void;\n /**\n * Props spread to the back ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n backButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n /**\n * Callback function triggered when the close button is pressed.\n * When provided, a close ButtonIcon is rendered as the end accessory.\n */\n onClose?: () => void;\n /**\n * Props spread to the close ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n closeButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n /**\n * Variant controlling header alignment and text size.\n * - Compact: center-aligned with HeadingSm text\n * - Display: left-aligned with HeadingLg text\n *\n * @default BottomSheetHeaderVariant.Compact\n */\n variant?: BottomSheetHeaderVariant;\n} & Omit<HeaderBaseProps, 'variant'>;\n"]}
1
+ {"version":3,"file":"BottomSheetHeader.types.cjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { HeaderBaseProps } from '../HeaderBase/HeaderBase.types';\n\n/**\n * BottomSheetHeader component props.\n *\n * Extends HeaderBase's root and title props to inherit standard props such as\n * `testID`, `accessibilityLabel`, `textProps`, and other View props.\n * Start and end accessories are controlled internally via `onBack` and\n * `onClose`, so `startAccessory`, `endAccessory`, `startButtonIconProps`,\n * and `endButtonIconProps` are not part of this API.\n */\nexport type BottomSheetHeaderProps = {\n /**\n * Callback function triggered when the back button is pressed.\n * When provided, a back arrow ButtonIcon is rendered as the start accessory.\n */\n onBack?: () => void;\n /**\n * Props spread to the back ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n backButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n /**\n * Callback function triggered when the close button is pressed.\n * When provided, a close ButtonIcon is rendered as the end accessory.\n */\n onClose?: () => void;\n /**\n * Props spread to the close ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n closeButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n} & Omit<\n HeaderBaseProps,\n | 'startAccessory'\n | 'endAccessory'\n | 'startButtonIconProps'\n | 'endButtonIconProps'\n>;\n"]}
@@ -1,19 +1,13 @@
1
1
  import type { ButtonIconProps } from "../ButtonIcon/ButtonIcon.types.cjs";
2
2
  import type { HeaderBaseProps } from "../HeaderBase/HeaderBase.types.cjs";
3
- /**
4
- * Variant options for BottomSheetHeader component.
5
- * - Compact: Center-aligned title with HeadingSm text (default)
6
- * - Display: Left-aligned title with HeadingLg text
7
- */
8
- export declare enum BottomSheetHeaderVariant {
9
- Display = "display",
10
- Compact = "compact"
11
- }
12
3
  /**
13
4
  * BottomSheetHeader component props.
14
5
  *
15
- * Extends HeaderBase's props (which extends ViewProps) to inherit standard
16
- * props such as `testID`, `accessibilityLabel`, and other View props.
6
+ * Extends HeaderBase's root and title props to inherit standard props such as
7
+ * `testID`, `accessibilityLabel`, `textProps`, and other View props.
8
+ * Start and end accessories are controlled internally via `onBack` and
9
+ * `onClose`, so `startAccessory`, `endAccessory`, `startButtonIconProps`,
10
+ * and `endButtonIconProps` are not part of this API.
17
11
  */
18
12
  export type BottomSheetHeaderProps = {
19
13
  /**
@@ -38,13 +32,5 @@ export type BottomSheetHeaderProps = {
38
32
  * Note: `iconName` and `onPress` are managed internally and excluded.
39
33
  */
40
34
  closeButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;
41
- /**
42
- * Variant controlling header alignment and text size.
43
- * - Compact: center-aligned with HeadingSm text
44
- * - Display: left-aligned with HeadingLg text
45
- *
46
- * @default BottomSheetHeaderVariant.Compact
47
- */
48
- variant?: BottomSheetHeaderVariant;
49
- } & Omit<HeaderBaseProps, 'variant'>;
35
+ } & Omit<HeaderBaseProps, 'startAccessory' | 'endAccessory' | 'startButtonIconProps' | 'endButtonIconProps'>;
50
36
  //# sourceMappingURL=BottomSheetHeader.types.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.types.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AAEtE;;;;GAIG;AACH,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;IACzE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;IAC1E;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"BottomSheetHeader.types.d.cts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;IACzE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;CAC3E,GAAG,IAAI,CACN,eAAe,EACb,gBAAgB,GAChB,cAAc,GACd,sBAAsB,GACtB,oBAAoB,CACvB,CAAC"}
@@ -1,19 +1,13 @@
1
1
  import type { ButtonIconProps } from "../ButtonIcon/ButtonIcon.types.mjs";
2
2
  import type { HeaderBaseProps } from "../HeaderBase/HeaderBase.types.mjs";
3
- /**
4
- * Variant options for BottomSheetHeader component.
5
- * - Compact: Center-aligned title with HeadingSm text (default)
6
- * - Display: Left-aligned title with HeadingLg text
7
- */
8
- export declare enum BottomSheetHeaderVariant {
9
- Display = "display",
10
- Compact = "compact"
11
- }
12
3
  /**
13
4
  * BottomSheetHeader component props.
14
5
  *
15
- * Extends HeaderBase's props (which extends ViewProps) to inherit standard
16
- * props such as `testID`, `accessibilityLabel`, and other View props.
6
+ * Extends HeaderBase's root and title props to inherit standard props such as
7
+ * `testID`, `accessibilityLabel`, `textProps`, and other View props.
8
+ * Start and end accessories are controlled internally via `onBack` and
9
+ * `onClose`, so `startAccessory`, `endAccessory`, `startButtonIconProps`,
10
+ * and `endButtonIconProps` are not part of this API.
17
11
  */
18
12
  export type BottomSheetHeaderProps = {
19
13
  /**
@@ -38,13 +32,5 @@ export type BottomSheetHeaderProps = {
38
32
  * Note: `iconName` and `onPress` are managed internally and excluded.
39
33
  */
40
34
  closeButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;
41
- /**
42
- * Variant controlling header alignment and text size.
43
- * - Compact: center-aligned with HeadingSm text
44
- * - Display: left-aligned with HeadingLg text
45
- *
46
- * @default BottomSheetHeaderVariant.Compact
47
- */
48
- variant?: BottomSheetHeaderVariant;
49
- } & Omit<HeaderBaseProps, 'variant'>;
35
+ } & Omit<HeaderBaseProps, 'startAccessory' | 'endAccessory' | 'startButtonIconProps' | 'endButtonIconProps'>;
50
36
  //# sourceMappingURL=BottomSheetHeader.types.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.types.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AAEtE;;;;GAIG;AACH,oBAAY,wBAAwB;IAClC,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;IACzE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;IAC1E;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,wBAAwB,CAAC;CACpC,GAAG,IAAI,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC"}
1
+ {"version":3,"file":"BottomSheetHeader.types.d.mts","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AACtE,OAAO,KAAK,EAAE,eAAe,EAAE,2CAAuC;AAEtE;;;;;;;;GAQG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;;;OAIG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;IACzE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC,IAAI,CAAC,eAAe,EAAE,UAAU,GAAG,SAAS,CAAC,CAAC,CAAC;CAC3E,GAAG,IAAI,CACN,eAAe,EACb,gBAAgB,GAChB,cAAc,GACd,sBAAsB,GACtB,oBAAoB,CACvB,CAAC"}
@@ -1,11 +1,2 @@
1
- /**
2
- * Variant options for BottomSheetHeader component.
3
- * - Compact: Center-aligned title with HeadingSm text (default)
4
- * - Display: Left-aligned title with HeadingLg text
5
- */
6
- export var BottomSheetHeaderVariant;
7
- (function (BottomSheetHeaderVariant) {
8
- BottomSheetHeaderVariant["Display"] = "display";
9
- BottomSheetHeaderVariant["Compact"] = "compact";
10
- })(BottomSheetHeaderVariant || (BottomSheetHeaderVariant = {}));
1
+ export {};
11
2
  //# sourceMappingURL=BottomSheetHeader.types.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"BottomSheetHeader.types.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,MAAM,CAAN,IAAY,wBAGX;AAHD,WAAY,wBAAwB;IAClC,+CAAmB,CAAA;IACnB,+CAAmB,CAAA;AACrB,CAAC,EAHW,wBAAwB,KAAxB,wBAAwB,QAGnC","sourcesContent":["import type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { HeaderBaseProps } from '../HeaderBase/HeaderBase.types';\n\n/**\n * Variant options for BottomSheetHeader component.\n * - Compact: Center-aligned title with HeadingSm text (default)\n * - Display: Left-aligned title with HeadingLg text\n */\nexport enum BottomSheetHeaderVariant {\n Display = 'display',\n Compact = 'compact',\n}\n\n/**\n * BottomSheetHeader component props.\n *\n * Extends HeaderBase's props (which extends ViewProps) to inherit standard\n * props such as `testID`, `accessibilityLabel`, and other View props.\n */\nexport type BottomSheetHeaderProps = {\n /**\n * Callback function triggered when the back button is pressed.\n * When provided, a back arrow ButtonIcon is rendered as the start accessory.\n */\n onBack?: () => void;\n /**\n * Props spread to the back ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n backButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n /**\n * Callback function triggered when the close button is pressed.\n * When provided, a close ButtonIcon is rendered as the end accessory.\n */\n onClose?: () => void;\n /**\n * Props spread to the close ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n closeButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n /**\n * Variant controlling header alignment and text size.\n * - Compact: center-aligned with HeadingSm text\n * - Display: left-aligned with HeadingLg text\n *\n * @default BottomSheetHeaderVariant.Compact\n */\n variant?: BottomSheetHeaderVariant;\n} & Omit<HeaderBaseProps, 'variant'>;\n"]}
1
+ {"version":3,"file":"BottomSheetHeader.types.mjs","sourceRoot":"","sources":["../../../src/components/BottomSheetHeader/BottomSheetHeader.types.ts"],"names":[],"mappings":"","sourcesContent":["import type { ButtonIconProps } from '../ButtonIcon/ButtonIcon.types';\nimport type { HeaderBaseProps } from '../HeaderBase/HeaderBase.types';\n\n/**\n * BottomSheetHeader component props.\n *\n * Extends HeaderBase's root and title props to inherit standard props such as\n * `testID`, `accessibilityLabel`, `textProps`, and other View props.\n * Start and end accessories are controlled internally via `onBack` and\n * `onClose`, so `startAccessory`, `endAccessory`, `startButtonIconProps`,\n * and `endButtonIconProps` are not part of this API.\n */\nexport type BottomSheetHeaderProps = {\n /**\n * Callback function triggered when the back button is pressed.\n * When provided, a back arrow ButtonIcon is rendered as the start accessory.\n */\n onBack?: () => void;\n /**\n * Props spread to the back ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n backButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n /**\n * Callback function triggered when the close button is pressed.\n * When provided, a close ButtonIcon is rendered as the end accessory.\n */\n onClose?: () => void;\n /**\n * Props spread to the close ButtonIcon component for additional properties\n * like `testID` or `accessibilityLabel`. Use this for testing or accessibility purposes.\n * Note: `iconName` and `onPress` are managed internally and excluded.\n */\n closeButtonProps?: Partial<Omit<ButtonIconProps, 'iconName' | 'onPress'>>;\n} & Omit<\n HeaderBaseProps,\n | 'startAccessory'\n | 'endAccessory'\n | 'startButtonIconProps'\n | 'endButtonIconProps'\n>;\n"]}