import * as React from 'react';
import { ValueSelector } from '../ValueSelector';
import { useAdaptable } from '../../AdaptableContext';
import { TagList } from '../../../components/Tag/Tag';
export const TagValueSelector = (props) => {
    const { api } = useAdaptable();
    const getDefaultTags = () => {
        return api.internalApi.getAvailableTags() ?? [];
    };
    const { availableTags = getDefaultTags(), selectedTags = [], onChange, singleSelect } = props;
    return (React.createElement(ValueSelector, { options: availableTags, value: selectedTags.map((tag) => api.internalApi.getLabelForTag(tag)), singleSelect: singleSelect, allowReorder: false, onChange: (selectedTagsIds, selectedTagsMap) => {
            onChange(selectedTagsIds.map((id) => selectedTagsMap.get(id)));
        }, toIdentifier: (tag) => api.internalApi.getLabelForTag(tag), toLabel: (tag) => api.internalApi.getLabelForTag(tag) }));
};
export const TagValueOptionsTags = (props) => {
    const { tags = [] } = props;
    const { api } = useAdaptable();
    return React.createElement(TagList, { tags: tags.map((tag) => api.internalApi.getLabelForTag(tag)) });
};
