@hhgtech/hhg-components
Version:
Hello Health Group common components
38 lines (35 loc) • 1.94 kB
JavaScript
import { _ as __rest } from './tslib.es6-00ab44b2.js';
import React__default from 'react';
import { useMantineTheme, Image } from '@mantine/core';
import { DatePickerInput } from '@mantine/dates';
import { I as ISO_FORMAT } from './index-8c40504a.js';
import './index-fe4471f4.js';
import { C as CommonGAssets } from './index-7adf994c.js';
import { M as MAPPED_LOCALE } from './index-3f09210d.js';
import { L as LOCALE } from './Locale-dc1237b9.js';
// Omit<MantineDatePickerInputProps, 'value'>
const DatePicker = (_a) => {
var _b;
var { value, fullWidth = true } = _a, rest = __rest(_a, ["value", "fullWidth"]);
const theme = useMantineTheme();
const isMarryBaby = theme.other.template === 'mb';
const valueFormat = (_b = ISO_FORMAT[process.env.UNIFY_LOCALE || LOCALE.Vietnam]) === null || _b === void 0 ? void 0 : _b.dateFormat;
return (React__default.createElement(DatePickerInput, Object.assign({ locale: MAPPED_LOCALE[process.env.UNIFY_LOCALE || LOCALE.Vietnam], valueFormat: valueFormat, size: "md", clearable: false, popoverProps: fullWidth
? {
styles: {
dropdown: {
minWidth: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
},
},
}
: {}, styles: {
root: {
position: 'relative',
},
rightSection: { pointerEvents: 'none', cursor: 'default' },
}, rightSection: React__default.createElement(Image, { src: CommonGAssets.getAssetPath(isMarryBaby ? 'MB-calendar.svg' : 'OutlineCalendar.svg'), width: 18, height: 18 }), value: value, placeholder: valueFormat }, rest, { className: `input-control ${(rest === null || rest === void 0 ? void 0 : rest.className) || ''}` })));
};
export { DatePicker as D };