@atlaskit/editor-plugin-extension
Version:
editor-plugin-extension plugin for @atlaskit/editor-core
64 lines (63 loc) • 2.3 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 as _validate } from '../utils';
function Date(_ref) {
var name = _ref.name,
field = _ref.field,
autoFocus = _ref.autoFocus,
onFieldChange = _ref.onFieldChange,
placeholder = _ref.placeholder,
intl = _ref.intl;
var label = field.label,
description = field.description,
defaultValue = field.defaultValue,
isRequired = field.isRequired,
isDisabled = field.isDisabled;
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: function validate(value) {
return _validate(field, value);
},
testId: "config-panel-date-picker-".concat(name),
isDisabled: isDisabled
}, function (_ref2) {
var fieldProps = _ref2.fieldProps,
error = _ref2.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: function onBlur() {
fieldProps.onBlur();
}
// eslint-disable-next-line @atlassian/perf-linting/no-unstable-inline-props -- Ignored via go/ees017 (to be fixed)
,
onChange: function 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
var _default_1 = injectIntl(Date);
export default _default_1;