@atlaskit/inline-edit 12.3.5 → 12.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @atlaskit/inline-edit
2
2
 
3
+ ## 12.4.1
4
+
5
+ ### Patch Changes
6
+
7
+ - [`4f5a3b9d776`](https://bitbucket.org/atlassian/atlassian-frontend/commits/4f5a3b9d776) - Improvement to last regression bugfix where internal form state persisted across blur and cancel incorrectly
8
+
9
+ ## 12.4.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [`2f2e72c5189`](https://bitbucket.org/atlassian/atlassian-frontend/commits/2f2e72c5189) - Remove unintentionally exposed types: `ref` and `createAnalyticsEvent` from the component props interface.
14
+
15
+ This could result in a change with TypeScript validate in theory, but these were never used and should not have been passed to this component for several major versions.
16
+
3
17
  ## 12.3.5
4
18
 
5
19
  ### Patch Changes
@@ -32,7 +32,7 @@ var buttonStyles = (0, _react2.css)({
32
32
  var analyticsAttributes = {
33
33
  componentName: 'inlineEdit',
34
34
  packageName: "@atlaskit/inline-edit",
35
- packageVersion: "12.3.5"
35
+ packageVersion: "12.4.1"
36
36
  };
37
37
  var noop = function noop() {};
38
38
  var InnerInlineEdit = function InnerInlineEdit(props) {
@@ -158,70 +158,72 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
158
158
  readView: readView
159
159
  });
160
160
  };
161
-
162
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
163
- return (0, _react2.jsx)(_Form.default, {
164
- onSubmit: function onSubmit(data) {
165
- return onConfirm(data.inlineEdit);
166
- }
167
- }, function (_ref) {
168
- var _ref$formProps = _ref.formProps,
169
- _onKeyDown = _ref$formProps.onKeyDown,
170
- onSubmit = _ref$formProps.onSubmit,
171
- formRef = _ref$formProps.ref;
172
- return (0, _react2.jsx)("form", {
173
- onKeyDown: function onKeyDown(e) {
174
- _onKeyDown(e);
175
- if (e.key === 'Esc' || e.key === 'Escape') {
176
- onCancel();
177
- }
178
- },
179
- onSubmit: onSubmit,
180
- ref: formRef
181
- }, shouldBeEditing ? (0, _react2.jsx)(_Field.default, {
182
- name: "inlineEdit",
183
- label: label,
184
- defaultValue: defaultValue,
185
- validate: validate,
186
- isRequired: isRequired,
187
- key: "edit-view" // used for reset to default value
188
- }, function (_ref2) {
189
- var fieldProps = _ref2.fieldProps,
190
- error = _ref2.error;
191
- return (0, _react2.jsx)("div", {
192
- css: fieldStyles,
193
- onBlur: function onBlur() {
194
- onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
195
- },
196
- onFocus: onEditViewWrapperFocus
197
- }, editView(_objectSpread(_objectSpread({}, fieldProps), {}, {
198
- errorMessage: error
199
- }), editViewRef), !hideActionButtons ? (0, _react2.jsx)(_buttons.default, {
200
- cancelButtonLabel: cancelButtonLabel,
201
- confirmButtonLabel: confirmButtonLabel,
202
- onMouseDown: function onMouseDown() {
203
- /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
204
- doNotFocusOnEditButton();
205
- },
206
- mode: mode,
207
- onCancelClick: onCancelClick
208
- }) : /** This is to allow Ctrl + Enter to submit without action buttons */
209
- (0, _react2.jsx)("button", {
210
- css: buttonStyles,
211
- type: "submit"
212
- }));
213
- }) : /** Field is used here only for the label */
214
- (0, _react2.jsx)(_Field.default, {
161
+ if (shouldBeEditing) {
162
+ return (0, _react2.jsx)(_Form.default, {
163
+ onSubmit: function onSubmit(data) {
164
+ return onConfirm(data.inlineEdit);
165
+ }
166
+ }, function (_ref) {
167
+ var _ref$formProps = _ref.formProps,
168
+ _onKeyDown = _ref$formProps.onKeyDown,
169
+ onSubmit = _ref$formProps.onSubmit,
170
+ formRef = _ref$formProps.ref;
171
+ return (/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
172
+ (0, _react2.jsx)("form", {
173
+ onKeyDown: function onKeyDown(e) {
174
+ _onKeyDown(e);
175
+ if (e.key === 'Esc' || e.key === 'Escape') {
176
+ onCancel();
177
+ }
178
+ },
179
+ onSubmit: onSubmit,
180
+ ref: formRef
181
+ }, (0, _react2.jsx)(_Field.default, {
182
+ name: "inlineEdit",
183
+ label: label,
184
+ defaultValue: defaultValue,
185
+ validate: validate,
186
+ isRequired: isRequired,
187
+ key: "edit-view" // used for reset to default value
188
+ }, function (_ref2) {
189
+ var fieldProps = _ref2.fieldProps,
190
+ error = _ref2.error;
191
+ return (0, _react2.jsx)("div", {
192
+ css: fieldStyles,
193
+ onBlur: function onBlur() {
194
+ onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
195
+ },
196
+ onFocus: onEditViewWrapperFocus
197
+ }, editView(_objectSpread(_objectSpread({}, fieldProps), {}, {
198
+ errorMessage: error
199
+ }), editViewRef), !hideActionButtons ? (0, _react2.jsx)(_buttons.default, {
200
+ cancelButtonLabel: cancelButtonLabel,
201
+ confirmButtonLabel: confirmButtonLabel,
202
+ onMouseDown: function onMouseDown() {
203
+ /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
204
+ doNotFocusOnEditButton();
205
+ },
206
+ mode: mode,
207
+ onCancelClick: onCancelClick
208
+ }) : /** This is to allow Ctrl + Enter to submit without action buttons */
209
+ (0, _react2.jsx)("button", {
210
+ css: buttonStyles,
211
+ type: "submit"
212
+ }));
213
+ }))
214
+ );
215
+ });
216
+ }
217
+ return (/** Form, Field are used here only for the label and spacing */
218
+ (0, _react2.jsx)("form", null, (0, _react2.jsx)(_Field.default, {
215
219
  name: "inlineEdit",
216
220
  label: label,
217
221
  defaultValue: "",
218
222
  isRequired: isRequired,
219
223
  key: "read-view" // used for reset to default value
220
- }, renderReadView));
221
- });
222
- /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
224
+ }, renderReadView))
225
+ );
223
226
  };
224
-
225
227
  var InlineEdit = function InlineEdit(props) {
226
228
  return (0, _react2.jsx)(_components.default.Consumer, null, function (tokens) {
227
229
  var mode = tokens.mode;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.3.5",
3
+ "version": "12.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -19,7 +19,7 @@ const buttonStyles = css({
19
19
  const analyticsAttributes = {
20
20
  componentName: 'inlineEdit',
21
21
  packageName: "@atlaskit/inline-edit",
22
- packageVersion: "12.3.5"
22
+ packageVersion: "12.4.1"
23
23
  };
24
24
  const noop = () => {};
25
25
  const InnerInlineEdit = props => {
@@ -134,68 +134,69 @@ const InnerInlineEdit = props => {
134
134
  readView: readView
135
135
  });
136
136
  };
137
-
138
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
139
- return jsx(Form, {
140
- onSubmit: data => onConfirm(data.inlineEdit)
141
- }, ({
142
- formProps: {
143
- onKeyDown,
144
- onSubmit,
145
- ref: formRef
146
- }
147
- }) => jsx("form", {
148
- onKeyDown: e => {
149
- onKeyDown(e);
150
- if (e.key === 'Esc' || e.key === 'Escape') {
151
- onCancel();
137
+ if (shouldBeEditing) {
138
+ return jsx(Form, {
139
+ onSubmit: data => onConfirm(data.inlineEdit)
140
+ }, ({
141
+ formProps: {
142
+ onKeyDown,
143
+ onSubmit,
144
+ ref: formRef
152
145
  }
153
- },
154
- onSubmit: onSubmit,
155
- ref: formRef
156
- }, shouldBeEditing ? jsx(Field, {
157
- name: "inlineEdit",
158
- label: label,
159
- defaultValue: defaultValue,
160
- validate: validate,
161
- isRequired: isRequired,
162
- key: "edit-view" // used for reset to default value
163
- }, ({
164
- fieldProps,
165
- error
166
- }) => jsx("div", {
167
- css: fieldStyles,
168
- onBlur: () => {
169
- onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
170
- },
171
- onFocus: onEditViewWrapperFocus
172
- }, editView({
173
- ...fieldProps,
174
- errorMessage: error
175
- }, editViewRef), !hideActionButtons ? jsx(Buttons, {
176
- cancelButtonLabel: cancelButtonLabel,
177
- confirmButtonLabel: confirmButtonLabel,
178
- onMouseDown: () => {
179
- /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
180
- doNotFocusOnEditButton();
181
- },
182
- mode: mode,
183
- onCancelClick: onCancelClick
184
- }) : /** This is to allow Ctrl + Enter to submit without action buttons */
185
- jsx("button", {
186
- css: buttonStyles,
187
- type: "submit"
188
- }))) : /** Field is used here only for the label */
189
- jsx(Field, {
190
- name: "inlineEdit",
191
- label: label,
192
- defaultValue: "",
193
- isRequired: isRequired,
194
- key: "read-view" // used for reset to default value
195
- }, renderReadView)));
196
- /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
146
+ }) => /* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
147
+ jsx("form", {
148
+ onKeyDown: e => {
149
+ onKeyDown(e);
150
+ if (e.key === 'Esc' || e.key === 'Escape') {
151
+ onCancel();
152
+ }
153
+ },
154
+ onSubmit: onSubmit,
155
+ ref: formRef
156
+ }, jsx(Field, {
157
+ name: "inlineEdit",
158
+ label: label,
159
+ defaultValue: defaultValue,
160
+ validate: validate,
161
+ isRequired: isRequired,
162
+ key: "edit-view" // used for reset to default value
163
+ }, ({
164
+ fieldProps,
165
+ error
166
+ }) => jsx("div", {
167
+ css: fieldStyles,
168
+ onBlur: () => {
169
+ onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
170
+ },
171
+ onFocus: onEditViewWrapperFocus
172
+ }, editView({
173
+ ...fieldProps,
174
+ errorMessage: error
175
+ }, editViewRef), !hideActionButtons ? jsx(Buttons, {
176
+ cancelButtonLabel: cancelButtonLabel,
177
+ confirmButtonLabel: confirmButtonLabel,
178
+ onMouseDown: () => {
179
+ /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
180
+ doNotFocusOnEditButton();
181
+ },
182
+ mode: mode,
183
+ onCancelClick: onCancelClick
184
+ }) : /** This is to allow Ctrl + Enter to submit without action buttons */
185
+ jsx("button", {
186
+ css: buttonStyles,
187
+ type: "submit"
188
+ })))));
189
+ }
190
+ return (/** Form, Field are used here only for the label and spacing */
191
+ jsx("form", null, jsx(Field, {
192
+ name: "inlineEdit",
193
+ label: label,
194
+ defaultValue: "",
195
+ isRequired: isRequired,
196
+ key: "read-view" // used for reset to default value
197
+ }, renderReadView))
198
+ );
197
199
  };
198
-
199
200
  const InlineEdit = props => {
200
201
  return jsx(GlobalTheme.Consumer, null, tokens => {
201
202
  const mode = tokens.mode;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.3.5",
3
+ "version": "12.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -23,7 +23,7 @@ var buttonStyles = css({
23
23
  var analyticsAttributes = {
24
24
  componentName: 'inlineEdit',
25
25
  packageName: "@atlaskit/inline-edit",
26
- packageVersion: "12.3.5"
26
+ packageVersion: "12.4.1"
27
27
  };
28
28
  var noop = function noop() {};
29
29
  var InnerInlineEdit = function InnerInlineEdit(props) {
@@ -149,70 +149,72 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
149
149
  readView: readView
150
150
  });
151
151
  };
152
-
153
- /* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
154
- return jsx(Form, {
155
- onSubmit: function onSubmit(data) {
156
- return onConfirm(data.inlineEdit);
157
- }
158
- }, function (_ref) {
159
- var _ref$formProps = _ref.formProps,
160
- _onKeyDown = _ref$formProps.onKeyDown,
161
- onSubmit = _ref$formProps.onSubmit,
162
- formRef = _ref$formProps.ref;
163
- return jsx("form", {
164
- onKeyDown: function onKeyDown(e) {
165
- _onKeyDown(e);
166
- if (e.key === 'Esc' || e.key === 'Escape') {
167
- onCancel();
168
- }
169
- },
170
- onSubmit: onSubmit,
171
- ref: formRef
172
- }, shouldBeEditing ? jsx(Field, {
173
- name: "inlineEdit",
174
- label: label,
175
- defaultValue: defaultValue,
176
- validate: validate,
177
- isRequired: isRequired,
178
- key: "edit-view" // used for reset to default value
179
- }, function (_ref2) {
180
- var fieldProps = _ref2.fieldProps,
181
- error = _ref2.error;
182
- return jsx("div", {
183
- css: fieldStyles,
184
- onBlur: function onBlur() {
185
- onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
186
- },
187
- onFocus: onEditViewWrapperFocus
188
- }, editView(_objectSpread(_objectSpread({}, fieldProps), {}, {
189
- errorMessage: error
190
- }), editViewRef), !hideActionButtons ? jsx(Buttons, {
191
- cancelButtonLabel: cancelButtonLabel,
192
- confirmButtonLabel: confirmButtonLabel,
193
- onMouseDown: function onMouseDown() {
194
- /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
195
- doNotFocusOnEditButton();
196
- },
197
- mode: mode,
198
- onCancelClick: onCancelClick
199
- }) : /** This is to allow Ctrl + Enter to submit without action buttons */
200
- jsx("button", {
201
- css: buttonStyles,
202
- type: "submit"
203
- }));
204
- }) : /** Field is used here only for the label */
205
- jsx(Field, {
152
+ if (shouldBeEditing) {
153
+ return jsx(Form, {
154
+ onSubmit: function onSubmit(data) {
155
+ return onConfirm(data.inlineEdit);
156
+ }
157
+ }, function (_ref) {
158
+ var _ref$formProps = _ref.formProps,
159
+ _onKeyDown = _ref$formProps.onKeyDown,
160
+ onSubmit = _ref$formProps.onSubmit,
161
+ formRef = _ref$formProps.ref;
162
+ return (/* eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions */
163
+ jsx("form", {
164
+ onKeyDown: function onKeyDown(e) {
165
+ _onKeyDown(e);
166
+ if (e.key === 'Esc' || e.key === 'Escape') {
167
+ onCancel();
168
+ }
169
+ },
170
+ onSubmit: onSubmit,
171
+ ref: formRef
172
+ }, jsx(Field, {
173
+ name: "inlineEdit",
174
+ label: label,
175
+ defaultValue: defaultValue,
176
+ validate: validate,
177
+ isRequired: isRequired,
178
+ key: "edit-view" // used for reset to default value
179
+ }, function (_ref2) {
180
+ var fieldProps = _ref2.fieldProps,
181
+ error = _ref2.error;
182
+ return jsx("div", {
183
+ css: fieldStyles,
184
+ onBlur: function onBlur() {
185
+ onEditViewWrapperBlur(fieldProps.isInvalid, onSubmit, formRef);
186
+ },
187
+ onFocus: onEditViewWrapperFocus
188
+ }, editView(_objectSpread(_objectSpread({}, fieldProps), {}, {
189
+ errorMessage: error
190
+ }), editViewRef), !hideActionButtons ? jsx(Buttons, {
191
+ cancelButtonLabel: cancelButtonLabel,
192
+ confirmButtonLabel: confirmButtonLabel,
193
+ onMouseDown: function onMouseDown() {
194
+ /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
195
+ doNotFocusOnEditButton();
196
+ },
197
+ mode: mode,
198
+ onCancelClick: onCancelClick
199
+ }) : /** This is to allow Ctrl + Enter to submit without action buttons */
200
+ jsx("button", {
201
+ css: buttonStyles,
202
+ type: "submit"
203
+ }));
204
+ }))
205
+ );
206
+ });
207
+ }
208
+ return (/** Form, Field are used here only for the label and spacing */
209
+ jsx("form", null, jsx(Field, {
206
210
  name: "inlineEdit",
207
211
  label: label,
208
212
  defaultValue: "",
209
213
  isRequired: isRequired,
210
214
  key: "read-view" // used for reset to default value
211
- }, renderReadView));
212
- });
213
- /* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
215
+ }, renderReadView))
216
+ );
214
217
  };
215
-
216
218
  var InlineEdit = function InlineEdit(props) {
217
219
  return jsx(GlobalTheme.Consumer, null, function (tokens) {
218
220
  var mode = tokens.mode;
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.3.5",
3
+ "version": "12.4.1",
4
4
  "sideEffects": false
5
5
  }
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { FieldProps } from '@atlaskit/form';
4
- interface CommonProps extends WithAnalyticsEventsProps {
4
+ interface CommonProps {
5
5
  /** Additional information to be included in the `context` of analytics events that come from button. */
6
6
  analyticsContext?: Record<string, any>;
7
7
  /** Accessibility label for the cancel action button. */
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
- import { UIAnalyticsEvent, WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
2
+ import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { FieldProps } from '@atlaskit/form';
4
- interface CommonProps extends WithAnalyticsEventsProps {
4
+ interface CommonProps {
5
5
  /** Additional information to be included in the `context` of analytics events that come from button. */
6
6
  analyticsContext?: Record<string, any>;
7
7
  /** Accessibility label for the cancel action button. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "12.3.5",
3
+ "version": "12.4.1",
4
4
  "description": "An inline edit displays a custom input component that switches between reading and editing on the same page.",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/"
@@ -40,7 +40,7 @@
40
40
  "@atlaskit/inline-dialog": "^13.6.0",
41
41
  "@atlaskit/textfield": "^5.6.0",
42
42
  "@atlaskit/theme": "^12.5.0",
43
- "@atlaskit/tokens": "^1.13.0",
43
+ "@atlaskit/tokens": "^1.14.0",
44
44
  "@babel/runtime": "^7.0.0",
45
45
  "@emotion/react": "^11.7.1"
46
46
  },
@@ -48,6 +48,7 @@
48
48
  "react": "^16.8.0"
49
49
  },
50
50
  "devDependencies": {
51
+ "@af/accessibility-testing": "*",
51
52
  "@atlaskit/datetime-picker": "^12.7.0",
52
53
  "@atlaskit/docs": "*",
53
54
  "@atlaskit/section-message": "^6.4.0",
package/report.api.md CHANGED
@@ -19,10 +19,9 @@ import { FieldProps } from '@atlaskit/form';
19
19
  import { jsx } from '@emotion/react';
20
20
  import { default as React_2 } from 'react';
21
21
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
22
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
23
22
 
24
23
  // @public (undocumented)
25
- interface CommonProps extends WithAnalyticsEventsProps {
24
+ interface CommonProps {
26
25
  analyticsContext?: Record<string, any>;
27
26
  cancelButtonLabel?: string;
28
27
  confirmButtonLabel?: string;
@@ -8,10 +8,9 @@ import { FieldProps } from '@atlaskit/form';
8
8
  import { jsx } from '@emotion/react';
9
9
  import { default as React_2 } from 'react';
10
10
  import { UIAnalyticsEvent } from '@atlaskit/analytics-next';
11
- import { WithAnalyticsEventsProps } from '@atlaskit/analytics-next';
12
11
 
13
12
  // @public (undocumented)
14
- interface CommonProps extends WithAnalyticsEventsProps {
13
+ interface CommonProps {
15
14
  analyticsContext?: Record<string, any>;
16
15
  cancelButtonLabel?: string;
17
16
  confirmButtonLabel?: string;