import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import './ConditionalDropdown.scss';
import Typography from '../Typography';
import classNames from 'classnames';
import { isTextTruncated, truncateText, } from '../../utils/truncateText/truncateText';
import Tooltip from '../Tooltip';
const OptionsDropdown = ({ onSelectVariable, dropdownPosition, filteredOptions = [], position = 'relative', width = '300px', zIndex = 1000, height = '160px', truncateTextValue = 34, isTruncateText = false, }) => {
    return (_jsxs("div", { className: classNames('ff-variable-dropdown', position), style: dropdownPosition
            ? {
                top: dropdownPosition.top + 30,
                left: dropdownPosition.left - 30,
                width,
                zIndex,
            }
            : { width, zIndex, height: height }, children: [filteredOptions?.map((option) => {
                const displayText = isTruncateText
                    ? truncateText(option?.name, truncateTextValue, 'pixel')
                    : option?.name;
                const shouldShowTooltip = isTruncateText
                    ? isTextTruncated(option?.name, truncateTextValue, 'pixel')
                    : false;
                return (_jsx("div", { className: "ff-variable-option", onClick: () => onSelectVariable(option), children: isTruncateText ? (_jsx(Tooltip, { title: shouldShowTooltip ? option?.name : '', children: _jsx(Typography, { children: displayText }) })) : (_jsx(Typography, { children: displayText })) }, option?.id));
            }), filteredOptions?.length === 0 && (_jsx("div", { className: "ff-variable-option .ff-variable-option-no-data ", children: _jsx(Typography, { as: "span", fontSize: 14, children: "No Option" }) }))] }));
};
export default OptionsDropdown;
//# sourceMappingURL=OptionsDropdown.js.map