import React, { forwardRef } from "react";
import { useForkRef } from "../../../../hooks";
import { Button, Textfield } from "./ui";
export var Target = /*#__PURE__*/ forwardRef(function(param, ref) {
    var value = param.value, opened = param.opened, valueToItemMap = param.valueToItemMap, label = param.label, placeholder = param.placeholder, onKeyDown = param.onKeyDown, labelPlacement = param.labelPlacement, size = param.size, contentLeft = param.contentLeft, contentRight = param.contentRight, disabled = param.disabled, readOnly = param.readOnly, renderValue = param.renderValue, selectProps = param.selectProps, inputWrapperRef = param.inputWrapperRef, multiselect = param.multiselect, view = param.view, helperText = param.helperText, treeId = param.treeId, activeDescendantItemValue = param.activeDescendantItemValue, isTargetAmount = param.isTargetAmount, onChange = param.onChange, chipView = param.chipView, separator = param.separator, requiredProps = param.requiredProps, hintProps = param.hintProps;
    var buttonRef = useForkRef(ref, inputWrapperRef);
    if (selectProps.renderTarget) {
        return /*#__PURE__*/ React.createElement("div", {
            ref: inputWrapperRef
        }, selectProps.renderTarget(Array.isArray(value) ? value.map(function(value) {
            return valueToItemMap.get(value);
        }) : valueToItemMap.get(value), opened));
    }
    return selectProps.target === 'button-like' ? /*#__PURE__*/ React.createElement(Button, {
        ref: buttonRef,
        opened: opened,
        value: value,
        valueToItemMap: valueToItemMap,
        onKeyDown: onKeyDown,
        label: label,
        size: size,
        disabled: disabled || readOnly,
        renderValue: renderValue,
        selectProps: selectProps,
        separator: separator,
        treeId: treeId,
        activeDescendantItemValue: activeDescendantItemValue
    }) : /*#__PURE__*/ React.createElement(Textfield, {
        ref: ref,
        inputWrapperRef: inputWrapperRef,
        opened: opened,
        multiselect: multiselect,
        value: value,
        label: label,
        placeholder: placeholder,
        onKeyDown: onKeyDown,
        labelPlacement: labelPlacement,
        size: size,
        view: view,
        contentLeft: contentLeft,
        contentRight: contentRight,
        helperText: helperText,
        treeId: treeId,
        activeDescendantItemValue: activeDescendantItemValue,
        disabled: disabled,
        readOnly: readOnly,
        isTargetAmount: isTargetAmount,
        valueToItemMap: valueToItemMap,
        renderValue: renderValue,
        onChange: onChange,
        chipView: chipView,
        requiredProps: requiredProps,
        hintProps: hintProps,
        chipType: selectProps.chipType,
        chipClickArea: selectProps.chipClickArea
    });
});
