"use client"; import { cn } from "@prototype/lib/utils"; import { Check, ChevronDown } from "lucide-react"; import { createContext, useContext, useState, type ButtonHTMLAttributes, type ReactNode, } from "react"; const PanelSelectContext = createContext<(() => void) | null>(null); export function usePanelSelectClose() { return useContext(PanelSelectContext); } type PanelSelectProps = { label: string; valueLabel: string; children: ReactNode; className?: string; defaultOpen?: boolean; }; export function PanelSelect({ label, valueLabel, children, className, defaultOpen = false, }: PanelSelectProps) { const [open, setOpen] = useState(defaultOpen); const close = () => setOpen(false); return (
{open ? (
event.stopPropagation()} > {children}
) : null}
); } type PanelMenuItemProps = Omit< ButtonHTMLAttributes, "type" | "onSelect" > & { selected?: boolean; onSelect?: () => void; children: ReactNode; }; export function PanelMenuItem({ selected = false, className, children, onSelect, onClick, ...props }: PanelMenuItemProps) { const closePanelSelect = usePanelSelectClose(); return ( ); } export function PanelMenuSeparator({ className }: { className?: string }) { return
; }