import React, { useEffect, useId, useState } from 'react'
import { useButton } from '@react-aria/button'
import { HiddenSelect, useSelect } from '@react-aria/select'
import { mergeRefs } from '@react-aria/utils'
import { useSelectState, type SelectProps as AriaSelectProps } from '@react-stately/select'
import { type Key } from '@react-types/shared'
import classnames from 'classnames'
import { FieldMessage } from '~components/FieldMessage'
import { Popover, useFloating } from '~components/MultiSelect/subcomponents/Popover'
import { type OverrideClassName } from '~components/types/OverrideClassName'
import { SelectProvider } from './context'
import {
ListBoxSection,
ListItem,
Option,
SectionDivider,
SelectPopoverContents,
SelectToggle,
type SelectPopoverContentsProps,
type SelectToggleProps,
} from './subcomponents'
import { type SingleSelectItem, type SingleSelectOption } from './types'
import { getDisabledKeysFromItems } from './utils/getDisabledKeysFromItems'
import { transformSelectItemToCollectionElement } from './utils/transformSelectItemToCollectionElement'
import styles from './SingleSelect.module.scss'
type OmittedAriaSelectProps = 'children' | 'items' | 'onSelectionChange'
export type SingleSelectProps