@yahoo/uds-mobile 2.3.4 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/build.gradle +39 -0
- package/android/src/main/AndroidManifest.xml +1 -0
- package/android/src/main/java/com/yahoo/uds/screencornerradius/UDSScreenCornerRadiusModule.kt +44 -0
- package/dist/bin/generateTheme.mjs +10 -0
- package/dist/bin/mobile/scripts/utils/configToRNMappings.mjs +4 -1
- package/dist/components/AndroidBackHandler.cjs +31 -0
- package/dist/components/AndroidBackHandler.d.cts +21 -0
- package/dist/components/AndroidBackHandler.d.cts.map +1 -0
- package/dist/components/AndroidBackHandler.d.ts +21 -0
- package/dist/components/AndroidBackHandler.d.ts.map +1 -0
- package/dist/components/AndroidBackHandler.js +30 -0
- package/dist/components/AndroidBackHandler.js.map +1 -0
- package/dist/components/Avatar.cjs +1 -1
- package/dist/components/Avatar.js +1 -1
- package/dist/components/Badge.cjs +1 -1
- package/dist/components/Badge.js +1 -1
- package/dist/components/BottomSheet/BottomSheet.cjs +336 -0
- package/dist/components/BottomSheet/BottomSheet.d.cts +33 -0
- package/dist/components/BottomSheet/BottomSheet.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts +33 -0
- package/dist/components/BottomSheet/BottomSheet.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheet.js +334 -0
- package/dist/components/BottomSheet/BottomSheet.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheetContent.cjs +65 -0
- package/dist/components/BottomSheet/BottomSheetContent.d.cts +22 -0
- package/dist/components/BottomSheet/BottomSheetContent.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetContent.d.ts +22 -0
- package/dist/components/BottomSheet/BottomSheetContent.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetContent.js +63 -0
- package/dist/components/BottomSheet/BottomSheetContent.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheetDismiss.cjs +28 -0
- package/dist/components/BottomSheet/BottomSheetDismiss.d.cts +25 -0
- package/dist/components/BottomSheet/BottomSheetDismiss.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetDismiss.d.ts +25 -0
- package/dist/components/BottomSheet/BottomSheetDismiss.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetDismiss.js +27 -0
- package/dist/components/BottomSheet/BottomSheetDismiss.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheetHandle.cjs +56 -0
- package/dist/components/BottomSheet/BottomSheetHandle.d.cts +14 -0
- package/dist/components/BottomSheet/BottomSheetHandle.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetHandle.d.ts +14 -0
- package/dist/components/BottomSheet/BottomSheetHandle.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetHandle.js +55 -0
- package/dist/components/BottomSheet/BottomSheetHandle.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheetHeader.cjs +69 -0
- package/dist/components/BottomSheet/BottomSheetHeader.d.cts +16 -0
- package/dist/components/BottomSheet/BottomSheetHeader.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetHeader.d.ts +16 -0
- package/dist/components/BottomSheet/BottomSheetHeader.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetHeader.js +68 -0
- package/dist/components/BottomSheet/BottomSheetHeader.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheetInternalProvider.cjs +26 -0
- package/dist/components/BottomSheet/BottomSheetInternalProvider.d.cts +23 -0
- package/dist/components/BottomSheet/BottomSheetInternalProvider.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetInternalProvider.d.ts +23 -0
- package/dist/components/BottomSheet/BottomSheetInternalProvider.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetInternalProvider.js +24 -0
- package/dist/components/BottomSheet/BottomSheetInternalProvider.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheetProvider.cjs +33 -0
- package/dist/components/BottomSheet/BottomSheetProvider.d.cts +24 -0
- package/dist/components/BottomSheet/BottomSheetProvider.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetProvider.d.ts +24 -0
- package/dist/components/BottomSheet/BottomSheetProvider.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetProvider.js +31 -0
- package/dist/components/BottomSheet/BottomSheetProvider.js.map +1 -0
- package/dist/components/BottomSheet/BottomSheetTrigger.cjs +28 -0
- package/dist/components/BottomSheet/BottomSheetTrigger.d.cts +25 -0
- package/dist/components/BottomSheet/BottomSheetTrigger.d.cts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetTrigger.d.ts +25 -0
- package/dist/components/BottomSheet/BottomSheetTrigger.d.ts.map +1 -0
- package/dist/components/BottomSheet/BottomSheetTrigger.js +27 -0
- package/dist/components/BottomSheet/BottomSheetTrigger.js.map +1 -0
- package/dist/components/BottomSheet/index.cjs +19 -0
- package/dist/components/BottomSheet/index.d.cts +11 -0
- package/dist/components/BottomSheet/index.d.ts +11 -0
- package/dist/components/BottomSheet/index.js +11 -0
- package/dist/components/BottomSheet/types.cjs +1 -0
- package/dist/components/BottomSheet/types.d.cts +173 -0
- package/dist/components/BottomSheet/types.d.cts.map +1 -0
- package/dist/components/BottomSheet/types.d.ts +173 -0
- package/dist/components/BottomSheet/types.d.ts.map +1 -0
- package/dist/components/BottomSheet/types.js +1 -0
- package/dist/components/BottomSheet/useBottomSheetDrag.cjs +191 -0
- package/dist/components/BottomSheet/useBottomSheetDrag.d.cts +69 -0
- package/dist/components/BottomSheet/useBottomSheetDrag.d.cts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetDrag.d.ts +69 -0
- package/dist/components/BottomSheet/useBottomSheetDrag.d.ts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetDrag.js +190 -0
- package/dist/components/BottomSheet/useBottomSheetDrag.js.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetScroll.cjs +61 -0
- package/dist/components/BottomSheet/useBottomSheetScroll.d.cts +48 -0
- package/dist/components/BottomSheet/useBottomSheetScroll.d.cts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetScroll.d.ts +48 -0
- package/dist/components/BottomSheet/useBottomSheetScroll.d.ts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetScroll.js +60 -0
- package/dist/components/BottomSheet/useBottomSheetScroll.js.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetSnapModel.cjs +142 -0
- package/dist/components/BottomSheet/useBottomSheetSnapModel.d.cts +79 -0
- package/dist/components/BottomSheet/useBottomSheetSnapModel.d.cts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetSnapModel.d.ts +79 -0
- package/dist/components/BottomSheet/useBottomSheetSnapModel.d.ts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetSnapModel.js +140 -0
- package/dist/components/BottomSheet/useBottomSheetSnapModel.js.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetStore.cjs +79 -0
- package/dist/components/BottomSheet/useBottomSheetStore.d.cts +45 -0
- package/dist/components/BottomSheet/useBottomSheetStore.d.cts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetStore.d.ts +45 -0
- package/dist/components/BottomSheet/useBottomSheetStore.d.ts.map +1 -0
- package/dist/components/BottomSheet/useBottomSheetStore.js +77 -0
- package/dist/components/BottomSheet/useBottomSheetStore.js.map +1 -0
- package/dist/components/BottomSheet/useExpansionMargins.cjs +57 -0
- package/dist/components/BottomSheet/useExpansionMargins.d.cts +59 -0
- package/dist/components/BottomSheet/useExpansionMargins.d.cts.map +1 -0
- package/dist/components/BottomSheet/useExpansionMargins.d.ts +59 -0
- package/dist/components/BottomSheet/useExpansionMargins.d.ts.map +1 -0
- package/dist/components/BottomSheet/useExpansionMargins.js +56 -0
- package/dist/components/BottomSheet/useExpansionMargins.js.map +1 -0
- package/dist/components/BottomSheet/useKeyboardAvoidance.cjs +53 -0
- package/dist/components/BottomSheet/useKeyboardAvoidance.d.cts +31 -0
- package/dist/components/BottomSheet/useKeyboardAvoidance.d.cts.map +1 -0
- package/dist/components/BottomSheet/useKeyboardAvoidance.d.ts +31 -0
- package/dist/components/BottomSheet/useKeyboardAvoidance.d.ts.map +1 -0
- package/dist/components/BottomSheet/useKeyboardAvoidance.js +52 -0
- package/dist/components/BottomSheet/useKeyboardAvoidance.js.map +1 -0
- package/dist/components/BottomSheet/utils.cjs +77 -0
- package/dist/components/BottomSheet/utils.d.cts +50 -0
- package/dist/components/BottomSheet/utils.d.cts.map +1 -0
- package/dist/components/BottomSheet/utils.d.ts +50 -0
- package/dist/components/BottomSheet/utils.d.ts.map +1 -0
- package/dist/components/BottomSheet/utils.js +72 -0
- package/dist/components/BottomSheet/utils.js.map +1 -0
- package/dist/components/Box.cjs +1 -1
- package/dist/components/Box.js +1 -1
- package/dist/components/Button.cjs +1 -1
- package/dist/components/Button.js +1 -1
- package/dist/components/Checkbox.cjs +1 -1
- package/dist/components/Checkbox.js +1 -1
- package/dist/components/Chip.cjs +1 -1
- package/dist/components/Chip.js +1 -1
- package/dist/components/Icon.cjs +1 -1
- package/dist/components/Icon.js +1 -1
- package/dist/components/IconButton.cjs +1 -1
- package/dist/components/IconButton.js +1 -1
- package/dist/components/Image.cjs +1 -1
- package/dist/components/Image.js +1 -1
- package/dist/components/Input.cjs +1 -1
- package/dist/components/Input.js +1 -1
- package/dist/components/Link.cjs +1 -1
- package/dist/components/Link.js +1 -1
- package/dist/components/Pressable.cjs +1 -1
- package/dist/components/Pressable.js +1 -1
- package/dist/components/Radio.cjs +1 -1
- package/dist/components/Radio.js +1 -1
- package/dist/components/Screen.cjs +1 -1
- package/dist/components/Screen.js +1 -1
- package/dist/components/Scrim.cjs +73 -0
- package/dist/components/Scrim.d.cts +43 -0
- package/dist/components/Scrim.d.cts.map +1 -0
- package/dist/components/Scrim.d.ts +43 -0
- package/dist/components/Scrim.d.ts.map +1 -0
- package/dist/components/Scrim.js +71 -0
- package/dist/components/Scrim.js.map +1 -0
- package/dist/components/Switch.cjs +1 -1
- package/dist/components/Switch.js +1 -1
- package/dist/components/Text.cjs +1 -1
- package/dist/components/Text.js +1 -1
- package/dist/components/UDSProvider.cjs +38 -0
- package/dist/components/UDSProvider.d.cts +30 -0
- package/dist/components/UDSProvider.d.cts.map +1 -0
- package/dist/components/UDSProvider.d.ts +30 -0
- package/dist/components/UDSProvider.d.ts.map +1 -0
- package/dist/components/UDSProvider.js +37 -0
- package/dist/components/UDSProvider.js.map +1 -0
- package/dist/native/UDSScreenCornerRadiusModule.cjs +30 -0
- package/dist/native/UDSScreenCornerRadiusModule.d.cts +12 -0
- package/dist/native/UDSScreenCornerRadiusModule.d.cts.map +1 -0
- package/dist/native/UDSScreenCornerRadiusModule.d.ts +12 -0
- package/dist/native/UDSScreenCornerRadiusModule.d.ts.map +1 -0
- package/dist/native/UDSScreenCornerRadiusModule.js +17 -0
- package/dist/native/UDSScreenCornerRadiusModule.js.map +1 -0
- package/dist/portal.cjs +81 -0
- package/dist/portal.d.cts +18 -0
- package/dist/portal.d.cts.map +1 -0
- package/dist/portal.d.ts +18 -0
- package/dist/portal.d.ts.map +1 -0
- package/dist/portal.js +79 -0
- package/dist/portal.js.map +1 -0
- package/expo-module.config.json +9 -0
- package/generated/styles.cjs +10 -0
- package/generated/styles.d.ts +15 -2
- package/generated/styles.mjs +10 -0
- package/generated/unistyles.d.ts +21 -0
- package/ios/UDSMobile.podspec +25 -0
- package/ios/UDSScreenCornerRadiusModule.swift +218 -0
- package/package.json +40 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
apply plugin: 'com.android.library'
|
|
2
|
+
|
|
3
|
+
group = 'com.yahoo.uds.screencornerradius'
|
|
4
|
+
version = '0.1.0'
|
|
5
|
+
|
|
6
|
+
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
|
+
apply from: expoModulesCorePlugin
|
|
8
|
+
applyKotlinExpoModulesCorePlugin()
|
|
9
|
+
useCoreDependencies()
|
|
10
|
+
useExpoPublishing()
|
|
11
|
+
|
|
12
|
+
def useManagedAndroidSdkVersions = false
|
|
13
|
+
if (useManagedAndroidSdkVersions) {
|
|
14
|
+
useDefaultAndroidSdkVersions()
|
|
15
|
+
} else {
|
|
16
|
+
buildscript {
|
|
17
|
+
ext.safeExtGet = { prop, fallback ->
|
|
18
|
+
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
project.android {
|
|
22
|
+
compileSdkVersion safeExtGet("compileSdkVersion", 36)
|
|
23
|
+
defaultConfig {
|
|
24
|
+
minSdkVersion safeExtGet("minSdkVersion", 24)
|
|
25
|
+
targetSdkVersion safeExtGet("targetSdkVersion", 36)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
android {
|
|
31
|
+
namespace "com.yahoo.uds.screencornerradius"
|
|
32
|
+
defaultConfig {
|
|
33
|
+
versionCode 1
|
|
34
|
+
versionName "0.1.0"
|
|
35
|
+
}
|
|
36
|
+
lintOptions {
|
|
37
|
+
abortOnError false
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<manifest />
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.yahoo.uds.screencornerradius
|
|
2
|
+
|
|
3
|
+
import android.app.Activity
|
|
4
|
+
import android.os.Build
|
|
5
|
+
import android.view.RoundedCorner
|
|
6
|
+
import android.view.Window
|
|
7
|
+
import expo.modules.kotlin.modules.Module
|
|
8
|
+
import expo.modules.kotlin.modules.ModuleDefinition
|
|
9
|
+
|
|
10
|
+
class UDSScreenCornerRadiusModule : Module() {
|
|
11
|
+
private val currentActivity: Activity?
|
|
12
|
+
get() = appContext.currentActivity
|
|
13
|
+
|
|
14
|
+
private fun getCornerRadiusSync(): Int? {
|
|
15
|
+
val activity = currentActivity ?: return null
|
|
16
|
+
|
|
17
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
|
|
18
|
+
val window: Window? = activity.window
|
|
19
|
+
val insets = window?.decorView?.rootWindowInsets
|
|
20
|
+
|
|
21
|
+
val pxRadius = insets
|
|
22
|
+
?.getRoundedCorner(RoundedCorner.POSITION_TOP_LEFT)
|
|
23
|
+
?.radius
|
|
24
|
+
?: return null
|
|
25
|
+
|
|
26
|
+
val density = activity.resources.displayMetrics.density
|
|
27
|
+
return (pxRadius / density).toInt()
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override fun definition() = ModuleDefinition {
|
|
34
|
+
Name("UDSScreenCornerRadius")
|
|
35
|
+
|
|
36
|
+
Function("getCornerRadiusSync") {
|
|
37
|
+
return@Function getCornerRadiusSync()
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
AsyncFunction("getCornerRadius") {
|
|
41
|
+
return@AsyncFunction getCornerRadiusSync()
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -505,6 +505,16 @@ function generateComponents(config, colorMode) {
|
|
|
505
505
|
}
|
|
506
506
|
const targetObj = isRootLayer && TEXT_ONLY_PROPS.has(propName) ? textStyleObj : viewStyleObj;
|
|
507
507
|
for (const rnProp of rnProps) targetObj[rnProp] = resolvedValue;
|
|
508
|
+
if (propName === "backgroundColor" && stateValue.type === "elevationAliases") {
|
|
509
|
+
const level = stateValue.value.replace("elevation-", "");
|
|
510
|
+
const elevationPreset = config.elevation[level];
|
|
511
|
+
if (elevationPreset) {
|
|
512
|
+
const preset = elevationPreset[colorMode];
|
|
513
|
+
targetObj.backgroundBlurRadius = preset.backgroundBlurRadius ?? 0;
|
|
514
|
+
const fb = preset.finalBackgroundValue;
|
|
515
|
+
if (fb) targetObj.backgroundBlurColor = `rgba(${fb.r}, ${fb.g}, ${fb.b}, ${parseInt(String(fb.a), 10) / 100})`;
|
|
516
|
+
}
|
|
517
|
+
}
|
|
508
518
|
if (stateValue.type === "iconSizes") targetObj.iconSizeToken = stateValue.value;
|
|
509
519
|
}
|
|
510
520
|
if (shadowValues.length > 0) viewStyleObj.boxShadow = boxShadowToCssString(shadowValues);
|
|
@@ -18,6 +18,8 @@ const PROPERTY_TO_RN_PROPS = {
|
|
|
18
18
|
borderRadius: ["borderRadius"],
|
|
19
19
|
iconSize: ["fontSize", "lineHeight"],
|
|
20
20
|
opacity: ["opacity"],
|
|
21
|
+
horizontalMargin: ["marginHorizontal"],
|
|
22
|
+
bottomMargin: ["marginBottom"],
|
|
21
23
|
size: ["fontSize", "lineHeight"],
|
|
22
24
|
shadow: ["boxShadow"],
|
|
23
25
|
insetShadow: ["boxShadow"],
|
|
@@ -27,7 +29,8 @@ const PROPERTY_TO_RN_PROPS = {
|
|
|
27
29
|
"fontSize",
|
|
28
30
|
"lineHeight",
|
|
29
31
|
"letterSpacing"
|
|
30
|
-
]
|
|
32
|
+
],
|
|
33
|
+
backdropBlur: ["backgroundBlurRadius"]
|
|
31
34
|
};
|
|
32
35
|
/**
|
|
33
36
|
* Properties that only apply to Text components in React Native.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
4
|
+
let react = require("react");
|
|
5
|
+
let react_native = require("react-native");
|
|
6
|
+
|
|
7
|
+
//#region src/components/AndroidBackHandler.tsx
|
|
8
|
+
/**
|
|
9
|
+
* Handles the Android hardware back button.
|
|
10
|
+
*
|
|
11
|
+
* While `isOpen` is true, intercepts the back press. If `dismissible`, calls
|
|
12
|
+
* `onDismiss`; otherwise swallows the event to prevent navigation.
|
|
13
|
+
*/
|
|
14
|
+
function AndroidBackHandler({ isOpen, dismissible, onDismiss }) {
|
|
15
|
+
(0, react.useEffect)(() => {
|
|
16
|
+
if (!isOpen) return;
|
|
17
|
+
const subscription = react_native.BackHandler.addEventListener("hardwareBackPress", () => {
|
|
18
|
+
if (dismissible) onDismiss();
|
|
19
|
+
return true;
|
|
20
|
+
});
|
|
21
|
+
return () => subscription.remove();
|
|
22
|
+
}, [
|
|
23
|
+
isOpen,
|
|
24
|
+
dismissible,
|
|
25
|
+
onDismiss
|
|
26
|
+
]);
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
//#endregion
|
|
31
|
+
exports.AndroidBackHandler = AndroidBackHandler;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/components/AndroidBackHandler.d.ts
|
|
3
|
+
interface AndroidBackHandlerProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
dismissible: boolean;
|
|
6
|
+
onDismiss: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Handles the Android hardware back button.
|
|
10
|
+
*
|
|
11
|
+
* While `isOpen` is true, intercepts the back press. If `dismissible`, calls
|
|
12
|
+
* `onDismiss`; otherwise swallows the event to prevent navigation.
|
|
13
|
+
*/
|
|
14
|
+
declare function AndroidBackHandler({
|
|
15
|
+
isOpen,
|
|
16
|
+
dismissible,
|
|
17
|
+
onDismiss
|
|
18
|
+
}: AndroidBackHandlerProps): null;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { AndroidBackHandler, type AndroidBackHandlerProps };
|
|
21
|
+
//# sourceMappingURL=AndroidBackHandler.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidBackHandler.d.cts","names":[],"sources":["../../src/components/AndroidBackHandler.tsx"],"mappings":";;UAGU,uBAAA;EACR,MAAA;EACA,WAAA;EACA,SAAA;AAAA;;;;;;AAAS;iBASF,kBAAA,CAAA;EAAqB,MAAA;EAAQ,WAAA;EAAa;AAAA,GAAa,uBAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/components/AndroidBackHandler.d.ts
|
|
3
|
+
interface AndroidBackHandlerProps {
|
|
4
|
+
isOpen: boolean;
|
|
5
|
+
dismissible: boolean;
|
|
6
|
+
onDismiss: () => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Handles the Android hardware back button.
|
|
10
|
+
*
|
|
11
|
+
* While `isOpen` is true, intercepts the back press. If `dismissible`, calls
|
|
12
|
+
* `onDismiss`; otherwise swallows the event to prevent navigation.
|
|
13
|
+
*/
|
|
14
|
+
declare function AndroidBackHandler({
|
|
15
|
+
isOpen,
|
|
16
|
+
dismissible,
|
|
17
|
+
onDismiss
|
|
18
|
+
}: AndroidBackHandlerProps): null;
|
|
19
|
+
//#endregion
|
|
20
|
+
export { AndroidBackHandler, type AndroidBackHandlerProps };
|
|
21
|
+
//# sourceMappingURL=AndroidBackHandler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidBackHandler.d.ts","names":[],"sources":["../../src/components/AndroidBackHandler.tsx"],"mappings":";;UAGU,uBAAA;EACR,MAAA;EACA,WAAA;EACA,SAAA;AAAA;;;;;;AAAS;iBASF,kBAAA,CAAA;EAAqB,MAAA;EAAQ,WAAA;EAAa;AAAA,GAAa,uBAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
import { useEffect } from "react";
|
|
3
|
+
import { BackHandler } from "react-native";
|
|
4
|
+
|
|
5
|
+
//#region src/components/AndroidBackHandler.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Handles the Android hardware back button.
|
|
8
|
+
*
|
|
9
|
+
* While `isOpen` is true, intercepts the back press. If `dismissible`, calls
|
|
10
|
+
* `onDismiss`; otherwise swallows the event to prevent navigation.
|
|
11
|
+
*/
|
|
12
|
+
function AndroidBackHandler({ isOpen, dismissible, onDismiss }) {
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (!isOpen) return;
|
|
15
|
+
const subscription = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
16
|
+
if (dismissible) onDismiss();
|
|
17
|
+
return true;
|
|
18
|
+
});
|
|
19
|
+
return () => subscription.remove();
|
|
20
|
+
}, [
|
|
21
|
+
isOpen,
|
|
22
|
+
dismissible,
|
|
23
|
+
onDismiss
|
|
24
|
+
]);
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
export { AndroidBackHandler };
|
|
30
|
+
//# sourceMappingURL=AndroidBackHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AndroidBackHandler.js","names":[],"sources":["../../src/components/AndroidBackHandler.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { BackHandler } from 'react-native';\n\ninterface AndroidBackHandlerProps {\n isOpen: boolean;\n dismissible: boolean;\n onDismiss: () => void;\n}\n\n/**\n * Handles the Android hardware back button.\n *\n * While `isOpen` is true, intercepts the back press. If `dismissible`, calls\n * `onDismiss`; otherwise swallows the event to prevent navigation.\n */\nfunction AndroidBackHandler({ isOpen, dismissible, onDismiss }: AndroidBackHandlerProps) {\n useEffect(() => {\n if (!isOpen) {\n return;\n }\n\n const subscription = BackHandler.addEventListener('hardwareBackPress', () => {\n if (dismissible) {\n onDismiss();\n }\n return true;\n });\n\n return () => subscription.remove();\n }, [isOpen, dismissible, onDismiss]);\n\n return null;\n}\n\nexport { AndroidBackHandler };\nexport type { AndroidBackHandlerProps };\n"],"mappings":";;;;;;;;;;;AAeA,SAAS,mBAAmB,EAAE,QAAQ,aAAa,aAAsC;AACvF,iBAAgB;AACd,MAAI,CAAC,OACH;EAGF,MAAM,eAAe,YAAY,iBAAiB,2BAA2B;AAC3E,OAAI,YACF,YAAW;AAEb,UAAO;IACP;AAEF,eAAa,aAAa,QAAQ;IACjC;EAAC;EAAQ;EAAa;EAAU,CAAC;AAEpC,QAAO"}
|
|
@@ -6,8 +6,8 @@ const require_components_IconSlot = require('./IconSlot.cjs');
|
|
|
6
6
|
const require_components_Text = require('./Text.cjs');
|
|
7
7
|
let react = require("react");
|
|
8
8
|
let react_native = require("react-native");
|
|
9
|
-
let generated_styles = require("../../generated/styles");
|
|
10
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
|
+
let generated_styles = require("../../generated/styles");
|
|
11
11
|
|
|
12
12
|
//#region src/components/Avatar.tsx
|
|
13
13
|
const abbreviationStrategies = {
|
|
@@ -4,8 +4,8 @@ import { IconSlot } from "./IconSlot.js";
|
|
|
4
4
|
import { Text as Text$1 } from "./Text.js";
|
|
5
5
|
import { forwardRef, useState } from "react";
|
|
6
6
|
import { Image } from "react-native";
|
|
7
|
-
import { avatarStyles } from "../../generated/styles";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { avatarStyles } from "../../generated/styles";
|
|
9
9
|
|
|
10
10
|
//#region src/components/Avatar.tsx
|
|
11
11
|
const abbreviationStrategies = {
|
|
@@ -5,8 +5,8 @@ const require_components_IconSlot = require('./IconSlot.cjs');
|
|
|
5
5
|
const require_components_Text = require('./Text.cjs');
|
|
6
6
|
const require_components_HStack = require('./HStack.cjs');
|
|
7
7
|
let react = require("react");
|
|
8
|
-
let generated_styles = require("../../generated/styles");
|
|
9
8
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
|
+
let generated_styles = require("../../generated/styles");
|
|
10
10
|
|
|
11
11
|
//#region src/components/Badge.tsx
|
|
12
12
|
/**
|
package/dist/components/Badge.js
CHANGED
|
@@ -3,8 +3,8 @@ import { IconSlot } from "./IconSlot.js";
|
|
|
3
3
|
import { Text } from "./Text.js";
|
|
4
4
|
import { HStack } from "./HStack.js";
|
|
5
5
|
import { memo, useMemo } from "react";
|
|
6
|
-
import { badgeStyles } from "../../generated/styles";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { badgeStyles } from "../../generated/styles";
|
|
8
8
|
|
|
9
9
|
//#region src/components/Badge.tsx
|
|
10
10
|
/**
|
|
@@ -0,0 +1,336 @@
|
|
|
1
|
+
/*! © 2026 Yahoo, Inc. UDS Mobile v0.0.0-development */
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
3
|
+
const require_runtime = require('../../_virtual/_rolldown/runtime.cjs');
|
|
4
|
+
const require_portal = require('../../portal.cjs');
|
|
5
|
+
const require_components_AndroidBackHandler = require('../AndroidBackHandler.cjs');
|
|
6
|
+
const require_components_Box = require('../Box.cjs');
|
|
7
|
+
const require_components_Scrim = require('../Scrim.cjs');
|
|
8
|
+
const require_native_UDSScreenCornerRadiusModule = require('../../native/UDSScreenCornerRadiusModule.cjs');
|
|
9
|
+
const require_components_BottomSheet_BottomSheetInternalProvider = require('./BottomSheetInternalProvider.cjs');
|
|
10
|
+
const require_components_BottomSheet_BottomSheetProvider = require('./BottomSheetProvider.cjs');
|
|
11
|
+
const require_components_BottomSheet_BottomSheetHandle = require('./BottomSheetHandle.cjs');
|
|
12
|
+
const require_components_BottomSheet_utils = require('./utils.cjs');
|
|
13
|
+
const require_components_BottomSheet_useBottomSheetDrag = require('./useBottomSheetDrag.cjs');
|
|
14
|
+
const require_components_BottomSheet_useBottomSheetSnapModel = require('./useBottomSheetSnapModel.cjs');
|
|
15
|
+
const require_components_BottomSheet_useExpansionMargins = require('./useExpansionMargins.cjs');
|
|
16
|
+
const require_components_BottomSheet_useKeyboardAvoidance = require('./useKeyboardAvoidance.cjs');
|
|
17
|
+
let react = require("react");
|
|
18
|
+
let react_native = require("react-native");
|
|
19
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
20
|
+
let generated_styles = require("../../../generated/styles");
|
|
21
|
+
let react_native_reanimated = require("react-native-reanimated");
|
|
22
|
+
react_native_reanimated = require_runtime.__toESM(react_native_reanimated);
|
|
23
|
+
let react_native_gesture_handler = require("react-native-gesture-handler");
|
|
24
|
+
let react_native_safe_area_context = require("react-native-safe-area-context");
|
|
25
|
+
let react_native_screens = require("react-native-screens");
|
|
26
|
+
|
|
27
|
+
//#region src/components/BottomSheet/BottomSheet.tsx
|
|
28
|
+
function useScreenCornerRadius() {
|
|
29
|
+
const [, forceUpdate] = (0, react.useState)(0);
|
|
30
|
+
(0, react.useEffect)(() => {
|
|
31
|
+
if (require_native_UDSScreenCornerRadiusModule.loadState === "pending") {
|
|
32
|
+
const listener = () => forceUpdate((n) => n + 1);
|
|
33
|
+
require_native_UDSScreenCornerRadiusModule.loadListeners.push(listener);
|
|
34
|
+
return () => {
|
|
35
|
+
const idx = require_native_UDSScreenCornerRadiusModule.loadListeners.indexOf(listener);
|
|
36
|
+
if (idx >= 0) require_native_UDSScreenCornerRadiusModule.loadListeners.splice(idx, 1);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
return {
|
|
41
|
+
module: require_native_UDSScreenCornerRadiusModule.nativeModule,
|
|
42
|
+
isLoaded: require_native_UDSScreenCornerRadiusModule.loadState === "loaded",
|
|
43
|
+
isFailed: require_native_UDSScreenCornerRadiusModule.loadState === "failed"
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* The core bottom sheet component for React Native.
|
|
48
|
+
*
|
|
49
|
+
* Renders a draggable, spring-animated sheet that snaps to configurable height
|
|
50
|
+
* positions. Supports modal (with scrim, blocks background interaction) and
|
|
51
|
+
* non-modal (no scrim, background remains interactive) modes, scroll coordination,
|
|
52
|
+
* keyboard avoidance, and optional edge-to-edge expansion at the max snap point.
|
|
53
|
+
*
|
|
54
|
+
* Must be wrapped in a {@link BottomSheetProvider} or provided a `controller` prop
|
|
55
|
+
* created via {@link useBottomSheetStore}.
|
|
56
|
+
*
|
|
57
|
+
* @example
|
|
58
|
+
* ```tsx
|
|
59
|
+
* const store = useBottomSheetStore();
|
|
60
|
+
*
|
|
61
|
+
* <BottomSheetProvider controller={store}>
|
|
62
|
+
* <BottomSheetTrigger render={<Button>Open</Button>} />
|
|
63
|
+
* <BottomSheet snapPoints={['30%', '80%']}>
|
|
64
|
+
* <BottomSheetHeader>Title</BottomSheetHeader>
|
|
65
|
+
* <BottomSheetContent>...</BottomSheetContent>
|
|
66
|
+
* </BottomSheet>
|
|
67
|
+
* </BottomSheetProvider>
|
|
68
|
+
* ```
|
|
69
|
+
*/
|
|
70
|
+
const BottomSheet = (0, react.memo)(function BottomSheet({ children, controller: controllerProp, snapPoints: snapPointsProp, height, defaultSnapPointIndex = 0, snapPointIndex: snapPointIndexProp, onSnapPointChange, onClose, dismissible = true, enableDrag = true, modal = true, showHandleIndicator = true, fullWidthAtMaxSnap = false, enableOverstretch = true, blurTarget, shouldMatchDeviceCornerRadius = true }) {
|
|
71
|
+
const controller = require_components_BottomSheet_BottomSheetProvider.useBottomSheetContext() ?? controllerProp;
|
|
72
|
+
const { module: screenCornerRadiusModule, isFailed: cornerRadiusFailed } = useScreenCornerRadius();
|
|
73
|
+
if (!controller) throw new Error("BottomSheet must be wrapped in BottomSheetProvider or provided a controller prop.");
|
|
74
|
+
if (cornerRadiusFailed) throw new Error("BottomSheet requires `expo-modules-core` to be installed.\nInstall it with: npx expo install expo-modules-core");
|
|
75
|
+
const { isOpen } = controller;
|
|
76
|
+
generated_styles.bottomSheetStyles.useVariants({});
|
|
77
|
+
const flatRoot = react_native.StyleSheet.flatten(generated_styles.bottomSheetStyles.root);
|
|
78
|
+
const marginHorizontal = flatRoot.marginHorizontal ?? 0;
|
|
79
|
+
const marginBottom = flatRoot.marginBottom ?? 0;
|
|
80
|
+
const blurIntensity = flatRoot.backgroundBlurRadius ?? 0;
|
|
81
|
+
const showBlurBox = blurIntensity > 0 && (react_native.Platform.OS === "ios" || blurTarget != null);
|
|
82
|
+
const opaqueBackground = flatRoot.backgroundColor ?? "#fff";
|
|
83
|
+
const sheetBackground = showBlurBox ? "transparent" : blurIntensity > 0 ? flatRoot.backgroundBlurColor ?? opaqueBackground : opaqueBackground;
|
|
84
|
+
const { top: safeTop, bottom: safeBottom } = (0, react_native_safe_area_context.useSafeAreaInsets)();
|
|
85
|
+
const isDetached = marginBottom > 0 || marginHorizontal > 0;
|
|
86
|
+
const bottomInsetPx = isDetached ? marginBottom : 0;
|
|
87
|
+
const expandedBottomInsetPx = fullWidthAtMaxSnap ? 0 : bottomInsetPx;
|
|
88
|
+
const tokenBorderRadius = flatRoot.borderRadius ?? 16;
|
|
89
|
+
const screenCornerRadius = shouldMatchDeviceCornerRadius ? screenCornerRadiusModule?.getCornerRadiusSync() ?? 0 : 0;
|
|
90
|
+
const bottomCornerGap = isDetached ? Math.min(marginHorizontal, marginBottom + safeBottom) : 0;
|
|
91
|
+
const bottomCornerRadius = screenCornerRadius > 0 ? Math.max(0, screenCornerRadius - bottomCornerGap) : tokenBorderRadius;
|
|
92
|
+
const containerHeight = (0, react_native_reanimated.useSharedValue)(react_native.Dimensions.get("window").height);
|
|
93
|
+
(0, react.useEffect)(() => {
|
|
94
|
+
const subscription = react_native.Dimensions.addEventListener("change", ({ window }) => {
|
|
95
|
+
containerHeight.value = window.height;
|
|
96
|
+
});
|
|
97
|
+
return () => subscription.remove();
|
|
98
|
+
}, [containerHeight]);
|
|
99
|
+
const { translateY, activeSnapIndex, isAnimating, resolvedSnapPoints, animateToSnap, animateToClose, animateToSnapWorklet, animateToCloseWorklet, getClosedTranslateY, getTranslateYForSnap } = require_components_BottomSheet_useBottomSheetSnapModel.useBottomSheetSnapModel({
|
|
100
|
+
snapPointsProp,
|
|
101
|
+
height,
|
|
102
|
+
defaultSnapPointIndex,
|
|
103
|
+
snapPointIndexProp,
|
|
104
|
+
onSnapPointChange,
|
|
105
|
+
containerHeight,
|
|
106
|
+
bottomInsetPx,
|
|
107
|
+
topInsetPx: safeTop,
|
|
108
|
+
sideInsetPx: marginHorizontal,
|
|
109
|
+
fullWidthAtMaxSnap,
|
|
110
|
+
expandedBottomInsetPx
|
|
111
|
+
});
|
|
112
|
+
const scrollOffsetY = (0, react_native_reanimated.useSharedValue)(0);
|
|
113
|
+
const scrollLocked = (0, react_native_reanimated.useSharedValue)(true);
|
|
114
|
+
const handleDismiss = (0, react.useCallback)(() => {
|
|
115
|
+
controller.close();
|
|
116
|
+
}, [controller]);
|
|
117
|
+
const { panGesture, panGestureRef, openTimeSV } = require_components_BottomSheet_useBottomSheetDrag.useBottomSheetDrag({
|
|
118
|
+
enableDrag,
|
|
119
|
+
dismissible,
|
|
120
|
+
enableOverstretch,
|
|
121
|
+
resolvedSnapPoints,
|
|
122
|
+
containerHeight,
|
|
123
|
+
bottomInsetPx,
|
|
124
|
+
translateY,
|
|
125
|
+
activeSnapIndex,
|
|
126
|
+
isAnimating,
|
|
127
|
+
animateToSnapWorklet,
|
|
128
|
+
animateToCloseWorklet,
|
|
129
|
+
onDismiss: handleDismiss,
|
|
130
|
+
scrollLocked,
|
|
131
|
+
scrollOffsetY,
|
|
132
|
+
getTranslateYForSnap
|
|
133
|
+
});
|
|
134
|
+
require_components_BottomSheet_useKeyboardAvoidance.useKeyboardAvoidance({
|
|
135
|
+
isOpen,
|
|
136
|
+
translateY,
|
|
137
|
+
isAnimating
|
|
138
|
+
});
|
|
139
|
+
const { animatedMarginStyle: expansionMarginStyle, maxSnapTranslateY: expansionMaxSnapTranslateY, thresholdTranslateY: expansionThresholdTranslateY } = require_components_BottomSheet_useExpansionMargins.useExpansionMargins({
|
|
140
|
+
enabled: fullWidthAtMaxSnap,
|
|
141
|
+
baseMarginHorizontal: marginHorizontal,
|
|
142
|
+
baseMarginBottom: marginBottom,
|
|
143
|
+
resolvedSnapPoints,
|
|
144
|
+
containerHeight,
|
|
145
|
+
bottomInsetPx,
|
|
146
|
+
expandedBottomInsetPx,
|
|
147
|
+
translateY
|
|
148
|
+
});
|
|
149
|
+
const expansionEdgeStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
150
|
+
if (!fullWidthAtMaxSnap) return {};
|
|
151
|
+
const bottomRadius = (0, react_native_reanimated.interpolate)(translateY.value, [expansionMaxSnapTranslateY, expansionThresholdTranslateY], [0, bottomCornerRadius], "clamp");
|
|
152
|
+
return {
|
|
153
|
+
borderBottomLeftRadius: bottomRadius,
|
|
154
|
+
borderBottomRightRadius: bottomRadius,
|
|
155
|
+
paddingBottom: (0, react_native_reanimated.interpolate)(translateY.value, [expansionMaxSnapTranslateY, expansionThresholdTranslateY], [safeBottom, 0], "clamp")
|
|
156
|
+
};
|
|
157
|
+
});
|
|
158
|
+
const internalContextValue = (0, react.useMemo)(() => ({
|
|
159
|
+
panGestureRef,
|
|
160
|
+
activeSnapIndex,
|
|
161
|
+
snapCount: resolvedSnapPoints.length,
|
|
162
|
+
scrollOffsetY,
|
|
163
|
+
scrollLocked
|
|
164
|
+
}), [
|
|
165
|
+
panGestureRef,
|
|
166
|
+
activeSnapIndex,
|
|
167
|
+
resolvedSnapPoints.length,
|
|
168
|
+
scrollOffsetY,
|
|
169
|
+
scrollLocked
|
|
170
|
+
]);
|
|
171
|
+
const wasOpen = (0, react.useRef)(false);
|
|
172
|
+
const [isRendered, setIsRendered] = (0, react.useState)(false);
|
|
173
|
+
(0, react.useEffect)(() => {
|
|
174
|
+
if (isOpen && !wasOpen.current) {
|
|
175
|
+
const initialIndex = snapPointIndexProp ?? defaultSnapPointIndex;
|
|
176
|
+
scrollOffsetY.value = 0;
|
|
177
|
+
scrollLocked.value = initialIndex !== resolvedSnapPoints.length - 1;
|
|
178
|
+
setIsRendered(true);
|
|
179
|
+
translateY.value = getClosedTranslateY();
|
|
180
|
+
openTimeSV.value = Date.now();
|
|
181
|
+
const timeout = setTimeout(() => {
|
|
182
|
+
animateToSnap(initialIndex);
|
|
183
|
+
}, 50);
|
|
184
|
+
wasOpen.current = true;
|
|
185
|
+
return () => clearTimeout(timeout);
|
|
186
|
+
}
|
|
187
|
+
if (!isOpen && wasOpen.current) {
|
|
188
|
+
animateToClose(() => {
|
|
189
|
+
setIsRendered(false);
|
|
190
|
+
});
|
|
191
|
+
onClose?.();
|
|
192
|
+
wasOpen.current = false;
|
|
193
|
+
}
|
|
194
|
+
}, [
|
|
195
|
+
isOpen,
|
|
196
|
+
snapPointIndexProp,
|
|
197
|
+
defaultSnapPointIndex,
|
|
198
|
+
translateY,
|
|
199
|
+
getClosedTranslateY,
|
|
200
|
+
animateToSnap,
|
|
201
|
+
animateToClose,
|
|
202
|
+
onClose,
|
|
203
|
+
openTimeSV,
|
|
204
|
+
scrollOffsetY,
|
|
205
|
+
scrollLocked,
|
|
206
|
+
resolvedSnapPoints.length
|
|
207
|
+
]);
|
|
208
|
+
(0, react.useEffect)(() => {
|
|
209
|
+
if (!isOpen || snapPointIndexProp === void 0) return;
|
|
210
|
+
animateToSnap(snapPointIndexProp);
|
|
211
|
+
}, [
|
|
212
|
+
isOpen,
|
|
213
|
+
snapPointIndexProp,
|
|
214
|
+
animateToSnap
|
|
215
|
+
]);
|
|
216
|
+
const animatedSheetStyle = (0, react_native_reanimated.useAnimatedStyle)(() => {
|
|
217
|
+
let effectiveBottom = 0;
|
|
218
|
+
if (isDetached) {
|
|
219
|
+
effectiveBottom = bottomInsetPx;
|
|
220
|
+
if (fullWidthAtMaxSnap) effectiveBottom = (0, react_native_reanimated.interpolate)(translateY.value, [expansionMaxSnapTranslateY, expansionThresholdTranslateY], [expandedBottomInsetPx, bottomInsetPx], "clamp");
|
|
221
|
+
}
|
|
222
|
+
return {
|
|
223
|
+
transform: [{ translateY: translateY.value }],
|
|
224
|
+
height: Math.max(100, containerHeight.value - translateY.value - effectiveBottom)
|
|
225
|
+
};
|
|
226
|
+
});
|
|
227
|
+
const initialIndex = snapPointIndexProp ?? defaultSnapPointIndex;
|
|
228
|
+
const windowH = modal ? react_native.Dimensions.get("window").height : 0;
|
|
229
|
+
const openSnapHeight = resolvedSnapPoints[initialIndex] ? require_components_BottomSheet_utils.resolveHeightToPx(resolvedSnapPoints[initialIndex], windowH) : 0;
|
|
230
|
+
const openTranslateY = windowH - Math.min(openSnapHeight, windowH - bottomInsetPx) - bottomInsetPx;
|
|
231
|
+
const closedTranslateY = windowH + bottomInsetPx;
|
|
232
|
+
if (!isOpen && !isRendered) return null;
|
|
233
|
+
const borderWidth = flatRoot.borderWidth ?? 0;
|
|
234
|
+
const sheetView = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureDetector, {
|
|
235
|
+
gesture: panGesture,
|
|
236
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_reanimated.default.View, {
|
|
237
|
+
style: [
|
|
238
|
+
internalStyles.sheet,
|
|
239
|
+
{
|
|
240
|
+
backgroundColor: sheetBackground,
|
|
241
|
+
borderTopLeftRadius: tokenBorderRadius,
|
|
242
|
+
borderTopRightRadius: tokenBorderRadius,
|
|
243
|
+
borderBottomLeftRadius: bottomCornerRadius,
|
|
244
|
+
borderBottomRightRadius: bottomCornerRadius,
|
|
245
|
+
paddingTop: 8,
|
|
246
|
+
marginHorizontal,
|
|
247
|
+
overflow: "hidden"
|
|
248
|
+
},
|
|
249
|
+
animatedSheetStyle,
|
|
250
|
+
fullWidthAtMaxSnap ? expansionMarginStyle : void 0,
|
|
251
|
+
fullWidthAtMaxSnap ? expansionEdgeStyle : void 0
|
|
252
|
+
],
|
|
253
|
+
accessibilityRole: "none",
|
|
254
|
+
children: [
|
|
255
|
+
showBlurBox && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Box.Box, {
|
|
256
|
+
style: react_native.StyleSheet.absoluteFill,
|
|
257
|
+
blur: blurIntensity,
|
|
258
|
+
blurTarget
|
|
259
|
+
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
260
|
+
style: [react_native.StyleSheet.absoluteFill, { backgroundColor: flatRoot.backgroundBlurColor }],
|
|
261
|
+
pointerEvents: "none"
|
|
262
|
+
})] }),
|
|
263
|
+
showHandleIndicator && enableDrag && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_BottomSheet_BottomSheetHandle.BottomSheetHandle, {}),
|
|
264
|
+
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
265
|
+
style: {
|
|
266
|
+
paddingHorizontal: flatRoot.paddingHorizontal ?? 16,
|
|
267
|
+
paddingBottom: flatRoot.paddingVertical ?? 8,
|
|
268
|
+
flex: 1
|
|
269
|
+
},
|
|
270
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_BottomSheet_BottomSheetInternalProvider.BottomSheetInternalProvider, {
|
|
271
|
+
value: internalContextValue,
|
|
272
|
+
children
|
|
273
|
+
})
|
|
274
|
+
}),
|
|
275
|
+
borderWidth > 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_reanimated.default.View, {
|
|
276
|
+
style: [
|
|
277
|
+
react_native.StyleSheet.absoluteFill,
|
|
278
|
+
{
|
|
279
|
+
borderColor: flatRoot.borderColor ?? "transparent",
|
|
280
|
+
borderWidth,
|
|
281
|
+
borderTopLeftRadius: tokenBorderRadius,
|
|
282
|
+
borderTopRightRadius: tokenBorderRadius,
|
|
283
|
+
borderBottomLeftRadius: bottomCornerRadius,
|
|
284
|
+
borderBottomRightRadius: bottomCornerRadius
|
|
285
|
+
},
|
|
286
|
+
fullWidthAtMaxSnap ? expansionEdgeStyle : void 0
|
|
287
|
+
],
|
|
288
|
+
pointerEvents: "none"
|
|
289
|
+
})
|
|
290
|
+
]
|
|
291
|
+
})
|
|
292
|
+
});
|
|
293
|
+
const modalOverlay = /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_native_gesture_handler.GestureHandlerRootView, {
|
|
294
|
+
style: internalStyles.modalRoot,
|
|
295
|
+
pointerEvents: isOpen ? "auto" : "none",
|
|
296
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_Scrim.Scrim, {
|
|
297
|
+
translateY,
|
|
298
|
+
openTranslateY,
|
|
299
|
+
closedTranslateY,
|
|
300
|
+
dismissible,
|
|
301
|
+
onDismiss: handleDismiss,
|
|
302
|
+
blurTarget
|
|
303
|
+
}), sheetView]
|
|
304
|
+
});
|
|
305
|
+
const nonModalOverlay = /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native.View, {
|
|
306
|
+
style: react_native.StyleSheet.absoluteFill,
|
|
307
|
+
pointerEvents: isOpen ? "box-none" : "none",
|
|
308
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_gesture_handler.GestureHandlerRootView, {
|
|
309
|
+
style: internalStyles.sheet,
|
|
310
|
+
pointerEvents: "auto",
|
|
311
|
+
children: sheetView
|
|
312
|
+
})
|
|
313
|
+
});
|
|
314
|
+
if (react_native.Platform.OS === "ios") return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(react_native_screens.FullWindowOverlay, { children: modal ? modalOverlay : nonModalOverlay });
|
|
315
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_portal.Portal, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(require_components_BottomSheet_BottomSheetProvider.BottomSheetProvider, {
|
|
316
|
+
controller,
|
|
317
|
+
children: [modal && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_components_AndroidBackHandler.AndroidBackHandler, {
|
|
318
|
+
dismissible,
|
|
319
|
+
onDismiss: handleDismiss,
|
|
320
|
+
isOpen
|
|
321
|
+
}), modal ? modalOverlay : nonModalOverlay]
|
|
322
|
+
}) });
|
|
323
|
+
});
|
|
324
|
+
const internalStyles = react_native.StyleSheet.create({
|
|
325
|
+
modalRoot: { flex: 1 },
|
|
326
|
+
sheet: {
|
|
327
|
+
position: "absolute",
|
|
328
|
+
left: 0,
|
|
329
|
+
right: 0,
|
|
330
|
+
top: 0,
|
|
331
|
+
minHeight: 100
|
|
332
|
+
}
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
//#endregion
|
|
336
|
+
exports.BottomSheet = BottomSheet;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
|
|
2
|
+
import { BottomSheetProps } from "./types.cjs";
|
|
3
|
+
import * as react from "react";
|
|
4
|
+
|
|
5
|
+
//#region src/components/BottomSheet/BottomSheet.d.ts
|
|
6
|
+
/**
|
|
7
|
+
* The core bottom sheet component for React Native.
|
|
8
|
+
*
|
|
9
|
+
* Renders a draggable, spring-animated sheet that snaps to configurable height
|
|
10
|
+
* positions. Supports modal (with scrim, blocks background interaction) and
|
|
11
|
+
* non-modal (no scrim, background remains interactive) modes, scroll coordination,
|
|
12
|
+
* keyboard avoidance, and optional edge-to-edge expansion at the max snap point.
|
|
13
|
+
*
|
|
14
|
+
* Must be wrapped in a {@link BottomSheetProvider} or provided a `controller` prop
|
|
15
|
+
* created via {@link useBottomSheetStore}.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* ```tsx
|
|
19
|
+
* const store = useBottomSheetStore();
|
|
20
|
+
*
|
|
21
|
+
* <BottomSheetProvider controller={store}>
|
|
22
|
+
* <BottomSheetTrigger render={<Button>Open</Button>} />
|
|
23
|
+
* <BottomSheet snapPoints={['30%', '80%']}>
|
|
24
|
+
* <BottomSheetHeader>Title</BottomSheetHeader>
|
|
25
|
+
* <BottomSheetContent>...</BottomSheetContent>
|
|
26
|
+
* </BottomSheet>
|
|
27
|
+
* </BottomSheetProvider>
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
declare const BottomSheet: react.NamedExoticComponent<BottomSheetProps>;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { BottomSheet };
|
|
33
|
+
//# sourceMappingURL=BottomSheet.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BottomSheet.d.cts","names":[],"sources":["../../../src/components/BottomSheet/BottomSheet.tsx"],"mappings":";;;;;;;;AAwBiB;;;;;;;;;;;;;;;;;;;;;cA0DX,WAAA,EAAW,KAAA,CAAA,oBAAA,CAAA,gBAAA"}
|