// Metro module 5222 (f5223). import _objectWithoutProperties from "../../../../_bundle/_objectWithoutProperties"; import { useMemo, useCallback } from "react"; import { View, Pressable } from "react-native"; import * as _ReanimatedRexport from "../../../../modules/reanimated/ReanimatedRexport"; import ReanimatedRexport, { useSharedValue, useAnimatedStyle } from "../../../../modules/reanimated/ReanimatedRexport"; import Module712 from "../../../../_bundle/Module712"; import { createStyleProperties, createStyles } from "../../Styles/native/createStyles"; import { createCardShadowToken } from "./CardTokens.native"; import MobileVisualRefreshExperiment from "../../../../modules/themes/experiments/MobileVisualRefreshExperiment"; import { useToken } from "../../../tokens/native/useToken"; import { isAndroid } from "../../../../utils/PlatformUtils"; import * as _spring from "../../../animation/reanimated/spring/spring"; import * as _springPresets from "../../../animation/reanimated/spring/springPresets"; import { AnimatedPressableHighlight } from "../../experimental/Pressables/native/AnimatedPressableHighlight.native"; let _excluded, AnimatedComponent, styleProperties, useStyles, PressableCard, __initData; export function Card(props) { const { start: start2 = true, end: end2 = true, shadow = "none", border = "faint", variant = "primary", ...props2 } = props; const isRefreshEnabled = MobileVisualRefreshExperiment("Card"); const token = useToken(Module712.modules.mobile.CARD_DEFAULT_RADIUS); let radius2 = props2.radius; if (radius2 == null) { radius2 = token; } const styles = useStyles(start2, end2, variant, shadow, border, radius2); const style = [styles.spacing, styles.card, props2.style]; const r2 = "onPress" in props2; const radius3 = radius2; if (r2 && props2.onPress != null) { let accessibilityRole = props2.accessibilityRole; const rest = _objectWithoutProperties(props2, _excluded); if (accessibilityRole == null) { accessibilityRole = "button"; } return ; } return ; } PressableCard = function PressableCard(props) { let r67; if (isAndroid()) { const { children: children2, start, end, radius, isRefreshEnabled: _isRefreshEnabled, ...props3 } = props; props.isRefreshEnabled; r67 = ({ cornerRadius: start ? radius : end ? radius : 0 }), [start, end, radius])} {...props3}>{children2}; } else { let backgroundColor, backgroundColorPressed; const { children, style, variant, onPressIn, onPressOut, isRefreshEnabled, radius: _radius, start: _start, end: _end, ...props2 } = props; props.radius; props.start; props.end; backgroundColor = void 0; backgroundColorPressed = void 0; const sharedValue = useSharedValue(0); const callback = useCallback((a0) => { sharedValue.set(1); if (onPressIn != null) { onPressIn(a0); } }, [sharedValue, onPressIn]); const callback2 = useCallback((a0) => { sharedValue.set(0); if (onPressOut != null) { onPressOut(a0); } }, [sharedValue, onPressOut]); const r40 = styleProperties(variant, isRefreshEnabled); backgroundColor = r40.backgroundColor; backgroundColorPressed = r40.backgroundColorPressed; const B = function B() { return { backgroundColor: _spring.withSpring(_ReanimatedRexport.interpolateColor(sharedValue.get(), [0, 1], [backgroundColor, backgroundColorPressed]), _springPresets.ON_PRESS_SPRING, "animate-always") }; }; B.__closure = { withSpring: _spring.withSpring, interpolateColor: _ReanimatedRexport.interpolateColor, pressed: sharedValue, backgroundColor, backgroundColorPressed, ON_PRESS_SPRING: _springPresets.ON_PRESS_SPRING }; B.__workletHash = 14943431549291; B.__initData = __initData; r67 = {children}; } return r67; }; _excluded = ["accessibilityRole"]; AnimatedComponent = ReanimatedRexport.createAnimatedComponent(Pressable); styleProperties = createStyleProperties(function(a0, r5 = false) { const backgroundColor2 = a0 === "primary" ? Module712.colors.TABLEROW_BACKGROUND_DEFAULT : a0 === "secondary" ? Module712.colors.CARD_SECONDARY_BACKGROUND_DEFAULT : a0 === "muted" ? Module712.colors.CARD_MUTED_BG : a0 === "transparent" ? Module712.unsafe_rawColors.TRANSPARENT : a0 === "control-secondary" ? Module712.colors.CONTROL_SECONDARY_BACKGROUND_DEFAULT : a0 === "surface-high" ? Module712.colors.BACKGROUND_SURFACE_HIGH : void 0; if (r5 === void 0) { r5 = false; } return { backgroundColor: backgroundColor2, backgroundColorPressed: a0 === "primary" ? Module712.colors.TABLEROW_BACKGROUND_PRESSED : a0 === "secondary" ? Module712.colors.CARD_SECONDARY_BACKGROUND_ACTIVE : a0 === "muted" ? Module712.colors.CARD_MUTED_PRESSED_BG : a0 === "transparent" ? r5 ? Module712.colors.BACKGROUND_MOD_SUBTLE : Module712.unsafe_rawColors.TRANSPARENT : a0 === "control-secondary" ? Module712.colors.CONTROL_SECONDARY_BACKGROUND_ACTIVE : a0 === "surface-high" ? Module712.colors.BACKGROUND_BASE_LOW : void 0 }; }); useStyles = createStyles((a0, a1, a2, a3, a4, a5) => { const backgroundColor2 = a2 === "primary" ? Module712.colors.TABLEROW_BACKGROUND_DEFAULT : a2 === "secondary" ? Module712.colors.CARD_SECONDARY_BACKGROUND_DEFAULT : a2 === "muted" ? Module712.colors.CARD_MUTED_BG : a2 === "transparent" ? Module712.unsafe_rawColors.TRANSPARENT : a2 === "control-secondary" ? Module712.colors.CONTROL_SECONDARY_BACKGROUND_DEFAULT : a2 === "surface-high" ? Module712.colors.BACKGROUND_SURFACE_HIGH : void 0; let borderColor = a4 !== "none" ? a4 === "subtle" ? Module712.colors.BORDER_SUBTLE : a4 === "strong" ? Module712.colors.BORDER_STRONG : a4 === "faint" ? Module712.colors.BORDER_MUTED : a4 === "control-secondary" ? Module712.colors.CONTROL_SECONDARY_BORDER_DEFAULT : void 0 : null; if (borderColor == null) { borderColor = backgroundColor2; } return { card: { ...createCardShadowToken(a3), borderTopStartRadius: a0 ? a5 : void 0, borderTopEndRadius: a0 ? a5 : void 0, borderBottomStartRadius: a1 ? a5 : void 0, borderBottomEndRadius: a1 ? a5 : void 0, borderColor, borderWidth: a4 !== "none" ? 1 : 0, backgroundColor: backgroundColor2 }, spacing: { padding: 16 } }; }); __initData = { code: "function CardNativeTsx1(){const{withSpring,interpolateColor,pressed,backgroundColor,backgroundColorPressed,ON_PRESS_SPRING}=this.__closure;const pressedColor=withSpring(interpolateColor(pressed.get(),[0,1],[backgroundColor,backgroundColorPressed]),ON_PRESS_SPRING,'animate-always');return{backgroundColor:pressedColor};}" }; export { Card as InternalCard };