@atlaskit/editor-plugin-extension
Version:
editor-plugin-extension plugin for @atlaskit/editor-core
66 lines (65 loc) • 1.98 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import React from 'react';
import { injectIntl } from 'react-intl';
import { DatePicker } from '@atlaskit/datetime-picker';
import { Field } from '@atlaskit/form';
import FieldMessages from '../FieldMessages';
import { validate } from '../utils';
function Date({
name,
field,
autoFocus,
onFieldChange,
placeholder,
intl
}) {
const {
label,
description,
defaultValue,
isRequired,
isDisabled
} = field;
return /*#__PURE__*/React.createElement(Field, {
name: name,
label: label,
defaultValue: defaultValue,
isRequired: isRequired
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
,
validate: value => validate(field, value),
testId: `config-panel-date-picker-${name}`,
isDisabled: isDisabled
}, ({
fieldProps,
error
}) => {
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(DatePicker
// Ignored via go/ees005
// eslint-disable-next-line react/jsx-props-no-spreading
, _extends({}, fieldProps, {
autoFocus: autoFocus
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
,
onBlur: () => {
fieldProps.onBlur();
}
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
,
onChange: value => {
fieldProps.onChange(value);
onFieldChange(name, true);
},
locale: intl.locale,
placeholder: placeholder,
shouldShowCalendarButton: true,
inputLabel: label
})), /*#__PURE__*/React.createElement(FieldMessages, {
error: error,
description: description
}));
});
}
// eslint-disable-next-line @typescript-eslint/ban-types
const _default_1 = injectIntl(Date);
export default _default_1;