import * as React from 'react';
import Radio from '../../components/Radio';
import { useAdaptable } from '../AdaptableContext';
export const DataSetSelector = ({ data }) => {
    const adaptable = useAdaptable();
    const dataSets = adaptable.api.dataSetApi.getDataSets();
    const selectedDataSet = adaptable.api.dataSetApi.getCurrentDataSet();
    const isDisabled = dataSets?.length === 1;
    const isSelected = selectedDataSet?.name === data?.name;
    const handleToggle = React.useCallback(() => {
        adaptable.api.dataSetApi.setDataSet(data.name);
    }, [isSelected]);
    return (React.createElement(Radio, { "data-name": "select-dataset-button", "data-value": data.name, disabled: isDisabled, checked: isSelected, onClick: handleToggle }));
};
