import _toConsumableArray from"@babel/runtime/helpers/toConsumableArray";import _slicedToArray from"@babel/runtime/helpers/slicedToArray";import _objectWithoutProperties from"@babel/runtime/helpers/objectWithoutProperties";var _excluded=["events","dateTimeView","locale","dropdownForm","dropdownClassName","dropdownRef","timeOptions","renderAdditionalControls","currentVisibleDate","onChangeCurrentVisibleDate","onDropdownOpen","dropdownOpen","ignoreOutsideClicksRefs","disabled","inputRef","disableDates"];import React,{forwardRef,useEffect,useRef}from"react";import{useClickOutside}from"../../../hooks/useClickOutside/useClickOutside";import{useForkRef}from"../../../hooks/useForkRef";import{setRef}from"../../../utils/setRef";import{DatePickerDropdown}from"../DatePickerDropdown/DatePickerDropdown";import{DatePickerFieldTypeTime}from"../DatePickerFieldTypeTime/DatePickerFieldTypeTime";import{datePickerPropFormatTypeDateTime,getDropdownZIndex,getTimeOptionsByFormat}from"../helpers";import{datePickerPropDateTimeViewDefault}from"../types";import{useCalendarVisible}from"../useCalendarVisible";export var DatePickerTypeTime=forwardRef(function(a,b){var c=a.events,d=a.dateTimeView,e=void 0===d?datePickerPropDateTimeViewDefault:d,f=a.locale,g=a.dropdownForm,h=a.dropdownClassName,i=a.dropdownRef,j=a.timeOptions,k=a.renderAdditionalControls,l=a.currentVisibleDate,m=a.onChangeCurrentVisibleDate,n=a.onDropdownOpen,o=a.dropdownOpen,p=a.ignoreOutsideClicksRefs,q=a.disabled,r=a.inputRef,s=a.disableDates,t=_objectWithoutProperties(a,_excluded),u=getTimeOptionsByFormat(t.format||datePickerPropFormatTypeDateTime,j),v=useRef(null),w=useRef(null),x=useRef(null),y=useCalendarVisible({dropdownOpen:o,onDropdownOpen:n,disabled:q,startRef:x}),z=_slicedToArray(y,2),A=z[0],B=z[1];return useEffect(function(){b&&setRef(b,v.current)},[b,v]),useClickOutside({isActive:A,ignoreClicksInsideRefs:[v,w].concat(_toConsumableArray(null!==p&&void 0!==p?p:[])),handler:B.off}),React.createElement(React.Fragment,null,React.createElement(DatePickerFieldTypeTime,Object.assign({},t,{ref:v,inputRef:useForkRef([x,r]),onClick:B.on,timeOptions:u,disabled:q})),React.createElement(DatePickerDropdown,{ref:useForkRef([i,w]),anchorRef:v,isOpen:A,value:a.value||void 0,type:"time",view:e,events:c,locale:f,minDate:a.minDate,maxDate:a.maxDate,form:g,className:h,onChange:a.onChange,renderAdditionalControls:k,timeOptions:u,zIndex:getDropdownZIndex(a.style),disableDates:s}))});
//# sourceMappingURL=DatePickerTypeTime.js.map