import { dayjsable, formatDayjsValue } from "@tachybase/components";
import { connect, mapProps, mapReadPretty } from "@tachybase/schema";
import { TimePicker } from "antd";
import { ReadPretty } from "./ReadPretty.mjs";
const mapTimeFormat = function() {
    return (props, field)=>{
        const format = props['format'] || 'HH:mm:ss';
        const onChange = props.onChange;
        return {
            ...props,
            format,
            value: dayjsable(props.value, format),
            onChange: (value)=>{
                if (onChange) onChange(formatDayjsValue(value, format) || null);
            }
        };
    };
};
const TimePicker_TimePicker = connect(TimePicker, mapProps(mapTimeFormat()), mapReadPretty(ReadPretty));
TimePicker_TimePicker.RangePicker = connect(TimePicker.RangePicker, mapProps(mapTimeFormat()), mapReadPretty(ReadPretty));
const time_picker_TimePicker = TimePicker_TimePicker;
export { TimePicker_TimePicker as TimePicker, time_picker_TimePicker as default };
