import { useState, useRef } from 'react'; import { Screen, View, Button, Text, Popover } from '../index'; export const PopoverExamples = () => { const [basicOpen, setBasicOpen] = useState(false); const [placementOpen, setPlacementOpen] = useState(null); const [arrowOpen, setArrowOpen] = useState(false); const basicButtonRef = useRef(null); const placementButtonRefs = useRef<{ [key: string]: any }>({}); const arrowButtonRef = useRef(null); const placements = [ { id: 'top', label: 'Top' }, { id: 'top-start', label: 'Top Start' }, { id: 'top-end', label: 'Top End' }, { id: 'bottom', label: 'Bottom' }, { id: 'bottom-start', label: 'Bottom Start' }, { id: 'bottom-end', label: 'Bottom End' }, ]; return ( Popover Examples {/* Basic Popover */} Basic Popover Basic Popover This is a basic popover with some content. {/* Placement Examples */} Placement Options {placements.map((placement) => ( (placementButtonRefs.current[placement.id] = ref) as any} style={{ display: 'inline-block' }} > {placementOpen === placement.id && ( setPlacementOpen(null)} anchor={{ current: placementButtonRefs.current[placement.id] }} placement={placement.id as any} > {placement.label} placement Positioned {placement.id} relative to the button )} ))} {/* Arrow Example */} With Arrow Arrow Popover This popover includes an arrow pointing to the anchor element. {/* Features Description */} Features • Automatically positions within viewport bounds • 12 placement options (top, bottom, left, right with start/end variants) • Optional arrow pointing to anchor element • Click outside or escape key to close • Smooth animations and transitions • Follows anchor element on scroll/resize (web) ); };