import * as React from 'react';
import { Select } from '../../../components/Select';
import { useAdaptable } from '../../AdaptableContext';
export const FieldSelector = (props) => {
    const { api } = useAdaptable();
    const fields = React.useMemo(() => {
        return api.expressionApi.internalApi.getFieldsOfType(props.type);
    }, []);
    const options = fields.map((field) => ({
        label: field.label ?? field.name,
        value: field.name,
    }));
    return (React.createElement(React.Fragment, null,
        React.createElement(Select, { "data-name": "column-selector", disabled: props.disabled, isMulti: false, menuPosition: props.menuPosition, value: props.value || undefined, placeholder: props.placeholder ?? 'Select Field', onChange: (fieldValue) => {
                props.onChange(fieldValue);
            }, options: options })));
};
