import React__default from 'react';
import { Chip } from '../../../Chip/Chip.js';
import { DatePickerSelect } from '../datePickerSelect/index.js';
import { getIsSameDay, formatDate } from '../../dateUtils.js';
import { ChipBorder } from '../datePickerSelect/styles.js';

function defaultGetInputLabel(dateRange, locale, variant) {
    if (getIsSameDay(dateRange.start, dateRange.end)) {
        return formatDate(dateRange.start, locale, variant);
    }
    else {
        const formattedStart = formatDate(dateRange.start, locale, variant);
        const formattedEnd = formatDate(dateRange.end, locale, variant);
        return `${formattedStart} - ${formattedEnd}`;
    }
}
function Input({ value, locale, variant, placeholder, handleClick, visible, disabled, hasError, leadingIcon, getInputLabel, }) {
    const renderInputLabel = typeof getInputLabel === 'function' ? getInputLabel : defaultGetInputLabel;
    const inputLabel = value
        ? renderInputLabel(value, locale, variant)
        : placeholder;
    switch (variant) {
        case 'select':
            return (React__default.createElement(DatePickerSelect, { handleClick: handleClick, visible: visible, disabled: disabled, placeholder: inputLabel, hasError: hasError, leadingIcon: leadingIcon }));
        case 'chip':
        default:
            return (React__default.createElement(ChipBorder, { hasError: hasError },
                React__default.createElement(Chip, { label: inputLabel, onClick: handleClick, disabled: disabled, selected: false })));
    }
}

export { Input };
