import { __assign } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { useContext } from 'react';
import { I18nReceiver as Receiver } from '../i18n';
import CombinedTimePickerBase from './components/CombinedTimePicker';
import CombinedTimePanel from './panels/combined-time-range-panel';
import { DisabledContext } from '../disabled';
import PickerContext from './context/PickerContext';
import { INPUT_WIDTH, defaultTimePickerProps } from './constants';
var PickerContextProvider = PickerContext.Provider;
export var CombinedTimeRangePicker = function (props) {
    var disabledContext = useContext(DisabledContext);
    var propsRequired = __assign(__assign({}, defaultTimePickerProps), props);
    var 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(CombinedTimePickerBase, __assign({}, propsRequired, { seperator: i18n.to, placeholder: placeholder || [i18n.startTime, i18n.endTime], disabled: disabled, width: width !== null && width !== void 0 ? width : INPUT_WIDTH, ContentComponent: CombinedTimePanel }), void 0) }), void 0)); } }), void 0));
};
export default CombinedTimeRangePicker;
