import { __assign } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { useContext } from 'react';
import { I18nReceiver as Receiver } from '../i18n';
import TimeRangePickerBase from './components/TimeRangePickerBase';
import { DisabledContext } from '../disabled';
import PickerContext from './context/PickerContext';
import { SINGLE_INPUT_WIDTH, defaultTimePickerProps } from './constants';
import TimePicker from './TimePicker';
var PickerContextProvider = PickerContext.Provider;
export var TimeRangePicker = function (props) {
    var disabledContext = useContext(DisabledContext);
    var propsRequired = __assign(__assign({}, defaultTimePickerProps), props);
    var format = propsRequired.format, placeholder = propsRequired.placeholder, width = propsRequired.width, _a = propsRequired.disabled, disabled = _a === void 0 ? disabledContext.value : _a;
    return (_jsx(Receiver, __assign({ componentName: "TimePicker" }, { children: function (i18n) { return (_jsx(PickerContextProvider, __assign({ value: {
                i18n: i18n,
            } }, { children: _jsx(TimeRangePickerBase, __assign({}, propsRequired, { format: format, placeholder: placeholder || [i18n.startTime, i18n.endTime], disabled: disabled, seperator: i18n.to, width: width !== null && width !== void 0 ? width : SINGLE_INPUT_WIDTH, PickerComponent: TimePicker }), void 0) }), void 0)); } }), void 0));
};
export default TimeRangePicker;
