import { __assign } from "tslib";
import { jsx as _jsx } from "react/jsx-runtime";
import { useContext } from 'react';
import { I18nReceiver as Receiver } from '../i18n';
import TimePickerBase from './components/TimePickerBase';
import TimePickerPanel from './panels/time-panel';
import { DisabledContext } from '../disabled';
import PickerContext from './context/PickerContext';
import { INPUT_WIDTH, defaultTimePickerProps } from './constants';
var PickerContextProvider = PickerContext.Provider;
export var TimePicker = 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(TimePickerBase, __assign({}, propsRequired, { format: format, placeholder: placeholder || i18n.time, disabled: disabled, width: width !== null && width !== void 0 ? width : INPUT_WIDTH, ContentComponent: TimePickerPanel }), void 0) }), void 0)); } }), void 0));
};
export default TimePicker;
