"use client"; // Adapted from Adobe React Spectrum starters (Apache-2.0). // Modified: owned composition, local runtime, scoped CSS and customization. // See THIRD_PARTY_NOTICES.md. import { Select as PrimitiveSelect, type SelectProps as AriaProps, SelectValue, Button, Popover, ListBox, ListBoxItem, type ListBoxItemProps, Label, Text, FieldError, type ValidationResult, composeRenderProps, } from "./react-aria-runtime.js"; import type { ReactNode, CSSProperties } from "react"; export interface AriaSelectProps extends Omit< AriaProps, "children" > { label: string; description?: string; errorMessage?: string | ((validation: ValidationResult) => string); children: ReactNode | ((item: T) => ReactNode); items?: Iterable; placeholder?: string; popoverClassName?: string; popoverStyle?: CSSProperties; } export function AriaSelect({ label, description, errorMessage, children, items, placeholder, className, popoverClassName, popoverStyle, ...props }: AriaSelectProps) { return ( `ynr-aria-select ynr-aria ${value ?? ""}`, )} > {description && ( {description} )} {errorMessage} "No results"} > {children} ); } export function AriaSelectItem({ className, ...props }: ListBoxItemProps) { return ( `ynr-aria-option ${value ?? ""}`, )} /> ); }