@nayan-ui/react-native
Version:
React Native Component Library for smooth and faster mobile application development.
42 lines (41 loc) • 1.74 kB
JavaScript
import * as React from 'react';
import { Platform, StyleSheet } from 'react-native';
import Animated, { FadeIn, FadeOut } from 'react-native-reanimated';
import * as PopoverPrimitive from '@rn-primitives/popover';
import { TextClassContext } from "./text.js";
import { cn } from "../../lib/utils.js";
import { jsx as _jsx } from "react-native-css-interop/jsx-runtime";
const Popover = PopoverPrimitive.Root;
const PopoverTrigger = PopoverPrimitive.Trigger;
const PopoverContent = /*#__PURE__*/React.forwardRef(({
className,
align = 'center',
sideOffset = 4,
portalHost,
...props
}, ref) => {
return _jsx(PopoverPrimitive.Portal, {
hostName: portalHost,
children: _jsx(PopoverPrimitive.Overlay, {
style: Platform.OS !== 'web' ? StyleSheet.absoluteFill : undefined,
children: _jsx(Animated.View, {
entering: FadeIn.duration(200),
exiting: FadeOut,
children: _jsx(TextClassContext.Provider, {
value: "text-popover-foreground",
children: _jsx(PopoverPrimitive.Content, {
ref: ref,
align: align,
sideOffset: sideOffset,
className: cn('z-50 w-72 rounded-md web:cursor-auto border border-border bg-popover p-4 shadow-md shadow-foreground/5 web:outline-none web:data-[side=bottom]:slide-in-from-top-2 web:data-[side=left]:slide-in-from-right-2 web:data-[side=right]:slide-in-from-left-2 web:data-[side=top]:slide-in-from-bottom-2 web:animate-in web:zoom-in-95 web:fade-in-0', className),
...props
})
})
})
})
});
});
PopoverContent.displayName = PopoverPrimitive.Content.displayName;
export { Popover, PopoverContent, PopoverTrigger };
//# sourceMappingURL=popover.js.map
;