// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

import classNames from 'classnames';
import { CLS_PREFIX } from '../../constants';
import FormField from '../FormField';
import Select from '../Select';
import { jsx as _jsx } from "react/jsx-runtime";
/**
 * `FormFieldSelect` componentis is used for making a choice among a set of related options.
 * See description of `Select` for [the full list of properties](#!/Select) of this component.
 * @since 1.12.3
 */
const FormFieldSelect = _ref => {
  let {
    size,
    baseClassName = `${CLS_PREFIX}form-field-select`,
    className,
    children,
    searchable,
    clearable,
    multiple,
    placeholder,
    ...props
  } = _ref;
  return /*#__PURE__*/_jsx(FormField, {
    className: classNames(baseClassName, className),
    ...props,
    children: _ref2 => {
      let {
        getId,
        getName,
        setValue,
        getValue,
        isDisabled
      } = _ref2;
      return /*#__PURE__*/_jsx(Select, {
        size: size,
        id: getId(),
        name: getName(),
        value: getValue(multiple ? [] : undefined),
        onChange: setValue,
        disabled: isDisabled(),
        searchable: searchable,
        clearable: clearable,
        multiple: multiple,
        placeholder: placeholder,
        children: children
      });
    }
  });
};
export default FormFieldSelect;