@atlaskit/inline-edit 13.0.9 → 13.1.0

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,11 @@
1
1
  # @atlaskit/inline-edit
2
2
 
3
+ ## 13.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#83505](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/83505) [`36b4633e8ee5`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/36b4633e8ee5) - Adds a testId prop to allow for easier testing
8
+
3
9
  ## 13.0.9
4
10
 
5
11
  ### Patch Changes
@@ -27,7 +27,7 @@ var fieldStyles = (0, _react2.css)({
27
27
  var analyticsAttributes = {
28
28
  componentName: 'inlineEdit',
29
29
  packageName: "@atlaskit/inline-edit",
30
- packageVersion: "13.0.9"
30
+ packageVersion: "13.1.0"
31
31
  };
32
32
  var noop = function noop() {};
33
33
  var InnerInlineEdit = function InnerInlineEdit(props) {
@@ -58,7 +58,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
58
58
  _props$onCancel = props.onCancel,
59
59
  providedOnCancel = _props$onCancel === void 0 ? noop : _props$onCancel,
60
60
  _props$onEdit = props.onEdit,
61
- providedOnEdit = _props$onEdit === void 0 ? noop : _props$onEdit;
61
+ providedOnEdit = _props$onEdit === void 0 ? noop : _props$onEdit,
62
+ testId = props.testId;
62
63
  var wasFocusReceivedSinceLastBlurRef = (0, _react.useRef)(false);
63
64
  var isControlled = typeof isEditing === 'undefined';
64
65
  var _useState = (0, _react.useState)(startWithEditViewOpen),
@@ -198,6 +199,7 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
198
199
  }, editView(_objectSpread(_objectSpread({}, fieldProps), {}, {
199
200
  errorMessage: error
200
201
  }), editViewRef), !hideActionButtons ? (0, _react2.jsx)(_buttons.default, {
202
+ testId: testId,
201
203
  cancelButtonLabel: cancelButtonLabel,
202
204
  confirmButtonLabel: confirmButtonLabel,
203
205
  onMouseDown: function onMouseDown() {
@@ -53,7 +53,8 @@ var Buttons = function Buttons(_ref) {
53
53
  var confirmButtonLabel = _ref.confirmButtonLabel,
54
54
  cancelButtonLabel = _ref.cancelButtonLabel,
55
55
  onMouseDown = _ref.onMouseDown,
56
- onCancelClick = _ref.onCancelClick;
56
+ onCancelClick = _ref.onCancelClick,
57
+ testId = _ref.testId;
57
58
  return (0, _react.jsx)("div", {
58
59
  css: buttonsContainerStyles
59
60
  }, (0, _react.jsx)("div", {
@@ -63,7 +64,8 @@ var Buttons = function Buttons(_ref) {
63
64
  icon: _check.default,
64
65
  UNSAFE_size: "small",
65
66
  onMouseDown: onMouseDown,
66
- label: confirmButtonLabel
67
+ label: confirmButtonLabel,
68
+ testId: testId && "".concat(testId, "--confirm")
67
69
  })), (0, _react.jsx)("div", {
68
70
  css: buttonWrapperBaseStyles
69
71
  }, (0, _react.jsx)(_new.IconButton, {
@@ -71,7 +73,8 @@ var Buttons = function Buttons(_ref) {
71
73
  UNSAFE_size: "small",
72
74
  label: cancelButtonLabel,
73
75
  onClick: onCancelClick,
74
- onMouseDown: onMouseDown
76
+ onMouseDown: onMouseDown,
77
+ testId: testId && "".concat(testId, "--cancel")
75
78
  })));
76
79
  };
77
80
  var _default = exports.default = Buttons;
@@ -14,7 +14,7 @@ const fieldStyles = css({
14
14
  const analyticsAttributes = {
15
15
  componentName: 'inlineEdit',
16
16
  packageName: "@atlaskit/inline-edit",
17
- packageVersion: "13.0.9"
17
+ packageVersion: "13.1.0"
18
18
  };
19
19
  const noop = () => {};
20
20
  const InnerInlineEdit = props => {
@@ -36,7 +36,8 @@ const InnerInlineEdit = props => {
36
36
  analyticsContext,
37
37
  onConfirm: providedOnConfirm,
38
38
  onCancel: providedOnCancel = noop,
39
- onEdit: providedOnEdit = noop
39
+ onEdit: providedOnEdit = noop,
40
+ testId
40
41
  } = props;
41
42
  const wasFocusReceivedSinceLastBlurRef = useRef(false);
42
43
  const isControlled = typeof isEditing === 'undefined';
@@ -174,6 +175,7 @@ const InnerInlineEdit = props => {
174
175
  ...fieldProps,
175
176
  errorMessage: error
176
177
  }, editViewRef), !hideActionButtons ? jsx(Buttons, {
178
+ testId: testId,
177
179
  cancelButtonLabel: cancelButtonLabel,
178
180
  confirmButtonLabel: confirmButtonLabel,
179
181
  onMouseDown: () => {
@@ -46,7 +46,8 @@ const Buttons = ({
46
46
  confirmButtonLabel,
47
47
  cancelButtonLabel,
48
48
  onMouseDown,
49
- onCancelClick
49
+ onCancelClick,
50
+ testId
50
51
  }) => {
51
52
  return jsx("div", {
52
53
  css: buttonsContainerStyles
@@ -57,7 +58,8 @@ const Buttons = ({
57
58
  icon: ConfirmIcon,
58
59
  UNSAFE_size: "small",
59
60
  onMouseDown: onMouseDown,
60
- label: confirmButtonLabel
61
+ label: confirmButtonLabel,
62
+ testId: testId && `${testId}--confirm`
61
63
  })), jsx("div", {
62
64
  css: buttonWrapperBaseStyles
63
65
  }, jsx(IconButton, {
@@ -65,7 +67,8 @@ const Buttons = ({
65
67
  UNSAFE_size: "small",
66
68
  label: cancelButtonLabel,
67
69
  onClick: onCancelClick,
68
- onMouseDown: onMouseDown
70
+ onMouseDown: onMouseDown,
71
+ testId: testId && `${testId}--cancel`
69
72
  })));
70
73
  };
71
74
  export default Buttons;
@@ -18,7 +18,7 @@ var fieldStyles = css({
18
18
  var analyticsAttributes = {
19
19
  componentName: 'inlineEdit',
20
20
  packageName: "@atlaskit/inline-edit",
21
- packageVersion: "13.0.9"
21
+ packageVersion: "13.1.0"
22
22
  };
23
23
  var noop = function noop() {};
24
24
  var InnerInlineEdit = function InnerInlineEdit(props) {
@@ -49,7 +49,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
49
49
  _props$onCancel = props.onCancel,
50
50
  providedOnCancel = _props$onCancel === void 0 ? noop : _props$onCancel,
51
51
  _props$onEdit = props.onEdit,
52
- providedOnEdit = _props$onEdit === void 0 ? noop : _props$onEdit;
52
+ providedOnEdit = _props$onEdit === void 0 ? noop : _props$onEdit,
53
+ testId = props.testId;
53
54
  var wasFocusReceivedSinceLastBlurRef = useRef(false);
54
55
  var isControlled = typeof isEditing === 'undefined';
55
56
  var _useState = useState(startWithEditViewOpen),
@@ -189,6 +190,7 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
189
190
  }, editView(_objectSpread(_objectSpread({}, fieldProps), {}, {
190
191
  errorMessage: error
191
192
  }), editViewRef), !hideActionButtons ? jsx(Buttons, {
193
+ testId: testId,
192
194
  cancelButtonLabel: cancelButtonLabel,
193
195
  confirmButtonLabel: confirmButtonLabel,
194
196
  onMouseDown: function onMouseDown() {
@@ -46,7 +46,8 @@ var Buttons = function Buttons(_ref) {
46
46
  var confirmButtonLabel = _ref.confirmButtonLabel,
47
47
  cancelButtonLabel = _ref.cancelButtonLabel,
48
48
  onMouseDown = _ref.onMouseDown,
49
- onCancelClick = _ref.onCancelClick;
49
+ onCancelClick = _ref.onCancelClick,
50
+ testId = _ref.testId;
50
51
  return jsx("div", {
51
52
  css: buttonsContainerStyles
52
53
  }, jsx("div", {
@@ -56,7 +57,8 @@ var Buttons = function Buttons(_ref) {
56
57
  icon: ConfirmIcon,
57
58
  UNSAFE_size: "small",
58
59
  onMouseDown: onMouseDown,
59
- label: confirmButtonLabel
60
+ label: confirmButtonLabel,
61
+ testId: testId && "".concat(testId, "--confirm")
60
62
  })), jsx("div", {
61
63
  css: buttonWrapperBaseStyles
62
64
  }, jsx(IconButton, {
@@ -64,7 +66,8 @@ var Buttons = function Buttons(_ref) {
64
66
  UNSAFE_size: "small",
65
67
  label: cancelButtonLabel,
66
68
  onClick: onCancelClick,
67
- onMouseDown: onMouseDown
69
+ onMouseDown: onMouseDown,
70
+ testId: testId && "".concat(testId, "--cancel")
68
71
  })));
69
72
  };
70
73
  export default Buttons;
@@ -6,6 +6,7 @@ interface ButtonsProp {
6
6
  cancelButtonLabel: string;
7
7
  onMouseDown: () => void;
8
8
  onCancelClick: (event: React.MouseEvent<HTMLElement>) => void;
9
+ testId?: string;
9
10
  }
10
- declare const Buttons: ({ confirmButtonLabel, cancelButtonLabel, onMouseDown, onCancelClick, }: ButtonsProp) => jsx.JSX.Element;
11
+ declare const Buttons: ({ confirmButtonLabel, cancelButtonLabel, onMouseDown, onCancelClick, testId, }: ButtonsProp) => jsx.JSX.Element;
11
12
  export default Buttons;
@@ -33,6 +33,10 @@ interface CommonProps {
33
33
  * starts in `editView`.
34
34
  */
35
35
  startWithEditViewOpen?: boolean;
36
+ /**
37
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
38
+ */
39
+ testId?: string;
36
40
  }
37
41
  export interface ExtendedFieldProps<FieldValue> extends FieldProps<FieldValue> {
38
42
  errorMessage?: string | undefined;
@@ -6,6 +6,7 @@ interface ButtonsProp {
6
6
  cancelButtonLabel: string;
7
7
  onMouseDown: () => void;
8
8
  onCancelClick: (event: React.MouseEvent<HTMLElement>) => void;
9
+ testId?: string;
9
10
  }
10
- declare const Buttons: ({ confirmButtonLabel, cancelButtonLabel, onMouseDown, onCancelClick, }: ButtonsProp) => jsx.JSX.Element;
11
+ declare const Buttons: ({ confirmButtonLabel, cancelButtonLabel, onMouseDown, onCancelClick, testId, }: ButtonsProp) => jsx.JSX.Element;
11
12
  export default Buttons;
@@ -33,6 +33,10 @@ interface CommonProps {
33
33
  * starts in `editView`.
34
34
  */
35
35
  startWithEditViewOpen?: boolean;
36
+ /**
37
+ * A `testId` prop is provided for specified elements, which is a unique string that appears as a data attribute `data-testid` in the rendered code, serving as a hook for automated tests
38
+ */
39
+ testId?: string;
36
40
  }
37
41
  export interface ExtendedFieldProps<FieldValue> extends FieldProps<FieldValue> {
38
42
  errorMessage?: string | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "13.0.9",
3
+ "version": "13.1.0",
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/"
@@ -61,7 +61,7 @@
61
61
  "@atlaskit/ssr": "*",
62
62
  "@atlaskit/tag": "^12.0.0",
63
63
  "@atlaskit/tag-group": "^10.2.0",
64
- "@atlaskit/textarea": "^5.1.0",
64
+ "@atlaskit/textarea": "^5.2.0",
65
65
  "@atlaskit/visual-regression": "*",
66
66
  "@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
67
67
  "@emotion/styled": "^11.0.0",