@talend/react-components
Version:
Set of react components.
31 lines • 1.03 kB
JavaScript
import { useContext } from 'react';
import { DateRangeContext } from '../Context';
import { START_DATE, END_DATE } from '../constants';
import CalendarPicker from '../../pickers/CalendarPicker';
import { jsx as _jsx } from "react/jsx-runtime";
export default function Picker(props) {
const {
startDate,
endDate,
pickerManagement
} = useContext(DateRangeContext);
const {
onStartChange,
onEndChange
} = pickerManagement;
return [props.focusedInput === START_DATE && /*#__PURE__*/_jsx(CalendarPicker, {
manageFocus: true,
selectedDate: startDate.value,
endDate: endDate.value,
onSubmit: onStartChange,
...props
}, "CalendarPicker_StartDate"), props.focusedInput === END_DATE && /*#__PURE__*/_jsx(CalendarPicker, {
manageFocus: true,
selectedDate: endDate.value,
startDate: startDate.value,
onSubmit: onEndChange,
...props
}, "CalendarPicker_EndDate")].filter(Boolean);
}
Picker.displayName = 'DateRange.Picker';
//# sourceMappingURL=Picker.component.js.map