import React, { createContext, use, useCallback, useState } from "react"; import { DayPicker, type DropdownProps } from "react-day-picker"; import { Select, SelectContent, SelectGroup, SelectItem, SelectStyles, SelectTrigger, SelectValue, } from "./Select"; const ContainerContext = createContext(null); export function CustomSelectDropdown(props: DropdownProps) { const { options, value, onChange, "aria-label": ariaLabel } = props; const container = use(ContainerContext); const handleValueChange = (newValue: string) => { if (onChange) { const syntheticEvent = { target: { value: newValue, }, } as React.ChangeEvent; onChange(syntheticEvent); } }; return ( ); } export function CustomDropdown() { const [selected, setSelected] = useState(); // Use explicit container to make the example work in the docs with shadow DOM const [container, setContainer] = useState(null); const handleRef = useCallback((element: HTMLDivElement | null) => { setContainer(element); }, []); return (
); }