UNPKG

@hhgtech/hhg-components

Version:
38 lines (35 loc) 1.96 kB
import { _ as __rest } from './tslib.es6-ea4dfe68.js'; import React__default from 'react'; import { useMantineTheme, Image } from '@mantine/core'; import { DatePickerInput } from '@mantine/dates'; import { I as ISO_FORMAT } from './index-5e947517.js'; import './index-90813715.js'; import { C as CommonGAssets } from './index-ebe66e27.js'; import { M as MAPPED_LOCALE } from './useMantineLocale-0c6bea99.js'; import { L as LOCALE } from './Locale-f270bd9d.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 };