"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
var _classnames = _interopRequireDefault(require("classnames"));
var _constants = require("../../constants");
var _FormField = _interopRequireDefault(require("../FormField"));
var _Select = _interopRequireDefault(require("../Select"));
var _jsxRuntime = require("react/jsx-runtime");
// Copyright 1999-2023. Plesk International GmbH. All rights reserved.

/**
 * `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 = `${_constants.CLS_PREFIX}form-field-select`,
    className,
    children,
    searchable,
    clearable,
    multiple,
    placeholder,
    ...props
  } = _ref;
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_FormField.default, {
    className: (0, _classnames.default)(baseClassName, className),
    ...props,
    children: _ref2 => {
      let {
        getId,
        getName,
        setValue,
        getValue,
        isDisabled
      } = _ref2;
      return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
        size: size,
        id: getId(),
        name: getName(),
        value: getValue(multiple ? [] : undefined),
        onChange: setValue,
        disabled: isDisabled(),
        searchable: searchable,
        clearable: clearable,
        multiple: multiple,
        placeholder: placeholder,
        children: children
      });
    }
  });
};
var _default = exports.default = FormFieldSelect;