import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
import { format } from 'date-fns';
import { FormLabel } from '../../../../../../scalars/components/fragments/index.js';
import { cn } from '../../../../../../scalars/lib/utils.js';
import { Icon } from '../../../../icon/icon.js';
import { InputDiff } from '../../../input/subcomponent/input-diff.js';
import { TextDiff } from '../../../input/subcomponent/text-diff.js';
import { getDateFormat } from '../../../date-time-picker/utils.js';
const DateInputDiff = ({ baseValue, value, viewMode, diffMode, icon, label, required, dateFormat, ...props }) => {
    const internalFormat = getDateFormat(dateFormat ?? '');
    const baseDate = baseValue ? format(new Date(baseValue), internalFormat) : '';
    const valueDate = value ? format(new Date(value), internalFormat) : '';
    return (_jsxs(_Fragment, { children: [label && (_jsx(FormLabel, { disabled: true, required: required, children: label })), _jsx(InputDiff, { className: cn('group'), ...props, children: viewMode === 'mixed' ? (_jsxs(_Fragment, { children: [_jsxs("div", { className: cn('flex flex-1 items-center gap-2 truncate [&>span]:truncate'), children: [_jsx(Icon, { name: icon, size: 16 }), _jsx(TextDiff, { baseValue: baseDate, value: valueDate, viewMode: "removal", diffMode: diffMode, className: cn('flex-1') })] }), _jsx("div", { className: cn('ml-3 mr-3 h-[34px] w-px bg-gray-300') }), _jsxs("div", { className: cn('flex flex-1 items-center gap-2 truncate [&>span]:truncate'), children: [_jsx(Icon, { name: icon, size: 16 }), _jsx(TextDiff, { baseValue: baseDate, value: valueDate, viewMode: "addition", diffMode: diffMode, className: cn('flex-1') })] })] })) : (_jsxs("div", { className: cn('flex flex-1 items-center gap-2 truncate [&>span]:truncate'), children: [_jsx(Icon, { name: icon, size: 16 }), _jsx(TextDiff, { baseValue: baseDate, value: valueDate, viewMode: viewMode, diffMode: diffMode, className: cn('flex-1') })] })) })] }));
};
export default DateInputDiff;
//# sourceMappingURL=date-picker-diff.js.map