UNPKG

@coveord/plasma-mantine

Version:

A Plasma flavoured Mantine theme

57 lines (56 loc) 1.75 kB
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime"; import { DateInput } from '@mantine/dates'; import dayjs from 'dayjs'; export const EditableDateRangePicker = ({ value, onChange, onFocus, startProps = {}, endProps = {} })=>{ const onChangeStart = (date)=>{ onChange?.([ dayjs(date).startOf('day').toDate(), value?.[1] ]); }; const onChangeEnd = (date)=>{ onChange?.([ value?.[0], dayjs(date).endOf('day').toDate() ]); }; return /*#__PURE__*/ _jsxs(_Fragment, { children: [ /*#__PURE__*/ _jsx(DateInput, { clearable: false, label: "Start", value: value?.[0], onChange: onChangeStart, onFocus: onFocus, popoverProps: { styles: { dropdown: { display: 'none' } } }, styles: { ...startProps.styles } }), /*#__PURE__*/ _jsx(DateInput, { clearable: false, label: "End", value: value?.[1], onChange: onChangeEnd, onFocus: onFocus, popoverProps: { styles: { dropdown: { display: 'none' } } }, styles: { ...endProps.styles } }) ] }); }; //# sourceMappingURL=EditableDateRangePicker.js.map