'use strict';

Object.defineProperty(exports, '__esModule', { value: true });

var React = require('react');
var Chip = require('../../../Chip/Chip.js');
var index = require('../datePickerSelect/index.js');
var dateUtils = require('../../dateUtils.js');
var styles = require('../datePickerSelect/styles.js');

function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }

var React__default = /*#__PURE__*/_interopDefaultLegacy(React);

function defaultGetInputLabel(dateRange, locale, variant) {
    if (dateUtils.getIsSameDay(dateRange.start, dateRange.end)) {
        return dateUtils.formatDate(dateRange.start, locale, variant);
    }
    else {
        const formattedStart = dateUtils.formatDate(dateRange.start, locale, variant);
        const formattedEnd = dateUtils.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['default'].createElement(index.DatePickerSelect, { handleClick: handleClick, visible: visible, disabled: disabled, placeholder: inputLabel, hasError: hasError, leadingIcon: leadingIcon }));
        case 'chip':
        default:
            return (React__default['default'].createElement(styles.ChipBorder, { hasError: hasError },
                React__default['default'].createElement(Chip.Chip, { label: inputLabel, onClick: handleClick, disabled: disabled, selected: false })));
    }
}

exports.Input = Input;
