import { DatePicker } from "@progress/kendo-react-dateinputs";
import withToolTip from "../../../hoc/withToolTip";
import { ComprehensiveProps } from "../../DomainProps";
import withLabel from "../../../hoc/withLabel";
import withHelperText from "../../../hoc/withHelperText";

export interface DateProps extends ComprehensiveProps {
  format?: string;
  defaultValue?: Date | null | undefined;
  min?: Date;
  max?: Date;
}

function DateWidgetView({
  value,
  widgetStyle,
  format,
  defaultValue,
  min,
  max,
}: DateProps) {
  return (
    <DatePicker
      id={widgetStyle?.id}
      className={widgetStyle?.className || ""}
      value={value !== undefined ? value : null}
      format={format}
      defaultValue={defaultValue}
      min={min}
      max={max}
    />
  );
}

export default withHelperText(withLabel(withToolTip(DateWidgetView)));