/** * Copyright (c) Paymium. * * This source code is licensed under the MIT license found in the * LICENSE file in the root of this projects source tree. */ import { memo } from 'react'; import { Sheet } from '../../overlay/Sheet'; import { YBox } from '../../layout/YBox'; import { Text } from '../../typography/Text'; import { FormField } from '../../forms/Form'; import { SelectLabel } from './Label'; import { SelectConfigProvider, SelectValueProvider } from './context'; import { useUncontrolled } from '@crossed/core'; import { SelectProps } from './types'; import { SelectTrigger } from './Trigger'; import { SelectContent } from './Content'; import { useFloating } from './useFloating'; import { Floating } from '../../overlay/Floating'; import { isWeb } from '@crossed/styled'; import { useMedia } from '../../useMedia'; export const Select = memo((e) => { const { label, description, extra, error, multiple, clearable, searchable, value: valueProps, onChange, defaultValue, items, disabled, id, onSearch, loading, renderValue, children, section, } = e; const { md } = useMedia(); const [value, setValue] = useUncontrolled({ value: valueProps, onChange, defaultValue, }); const { refs, floatingStyles } = useFloating(); return ( {children} {!!error && {error.toString()}} ); });