import React from 'react';
import i18n from 'ui-i18n';
import classnames from 'classnames';
import { pipe } from 'ramda';
import { useWorkflowDueDate } from '../hooks/useWorkflowDueDate';
import { DateEditor } from '../../../DateEditor';
import { useStyles } from './styles';
export var DueDateField = function (_a) {
    var taskId = _a.taskId, dueDate = _a.dueDate, isTaskOpen = _a.isTaskOpen, className = _a.className;
    var styles = useStyles();
    var _b = useWorkflowDueDate({
        dueDate: dueDate,
        taskId: taskId,
        isOpen: isTaskOpen
    }), updateDueDate = _b.updateDueDate, updateRequestIsInProgress = _b.updateRequestIsInProgress, readOnly = _b.readOnly;
    return (React.createElement(DateEditor, { disabled: updateRequestIsInProgress || readOnly, value: dueDate, label: i18n.text('Due date'), onChange: pipe(function (date) { return date && date.getTime(); }, updateDueDate), slotProps: {
            textField: {
                className: classnames(styles.dueDate, className),
                size: 'small',
                InputProps: { className: styles.dueDateInput },
                InputLabelProps: {
                    classes: { root: styles.inputLabel }
                }
            }
        } }));
};
