@atlaskit/inline-edit 13.6.1 → 13.7.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,19 @@
1
1
  # @atlaskit/inline-edit
2
2
 
3
+ ## 13.7.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#132894](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/pull-requests/132894)
8
+ [`83b955d2f3259`](https://stash.atlassian.com/projects/CONFCLOUD/repos/confluence-frontend/commits/83b955d2f3259) -
9
+ [ux] update button label to improve accessibility
10
+
11
+ ## 13.6.2
12
+
13
+ ### Patch Changes
14
+
15
+ - Updated dependencies
16
+
3
17
  ## 13.6.1
4
18
 
5
19
  ### Patch Changes
@@ -11,6 +11,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
11
11
  var _react = _interopRequireWildcard(require("react"));
12
12
  var _react2 = require("@emotion/react");
13
13
  var _analyticsNext = require("@atlaskit/analytics-next");
14
+ var _noop = _interopRequireDefault(require("@atlaskit/ds-lib/noop"));
14
15
  var _Field = _interopRequireDefault(require("@atlaskit/form/Field"));
15
16
  var _Form = _interopRequireDefault(require("@atlaskit/form/Form"));
16
17
  var _pressable = _interopRequireDefault(require("@atlaskit/primitives/pressable"));
@@ -32,9 +33,8 @@ var fieldStyles = (0, _react2.css)({
32
33
  var analyticsAttributes = {
33
34
  componentName: 'inlineEdit',
34
35
  packageName: "@atlaskit/inline-edit",
35
- packageVersion: "13.6.1"
36
+ packageVersion: "13.7.0"
36
37
  };
37
- var noop = function noop() {};
38
38
  var InnerInlineEdit = function InnerInlineEdit(props) {
39
39
  var _props$startWithEditV = props.startWithEditViewOpen,
40
40
  startWithEditViewOpen = _props$startWithEditV === void 0 ? false : _props$startWithEditV,
@@ -48,6 +48,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
48
48
  readViewFitContainerWidth = _props$readViewFitCon === void 0 ? false : _props$readViewFitCon,
49
49
  _props$editButtonLabe = props.editButtonLabel,
50
50
  editButtonLabel = _props$editButtonLabe === void 0 ? 'Edit' : _props$editButtonLabe,
51
+ _props$editLabel = props.editLabel,
52
+ editLabel = _props$editLabel === void 0 ? 'edit' : _props$editLabel,
51
53
  _props$confirmButtonL = props.confirmButtonLabel,
52
54
  confirmButtonLabel = _props$confirmButtonL === void 0 ? 'Confirm' : _props$confirmButtonL,
53
55
  _props$cancelButtonLa = props.cancelButtonLabel,
@@ -61,9 +63,9 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
61
63
  analyticsContext = props.analyticsContext,
62
64
  providedOnConfirm = props.onConfirm,
63
65
  _props$onCancel = props.onCancel,
64
- providedOnCancel = _props$onCancel === void 0 ? noop : _props$onCancel,
66
+ providedOnCancel = _props$onCancel === void 0 ? _noop.default : _props$onCancel,
65
67
  _props$onEdit = props.onEdit,
66
- providedOnEdit = _props$onEdit === void 0 ? noop : _props$onEdit,
68
+ providedOnEdit = _props$onEdit === void 0 ? _noop.default : _props$onEdit,
67
69
  testId = props.testId;
68
70
  var wasFocusReceivedSinceLastBlurRef = (0, _react.useRef)(false);
69
71
  var isControlled = typeof isEditing === 'undefined';
@@ -115,7 +117,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
115
117
  }
116
118
  }, [doNotFocusOnEditButton]);
117
119
 
118
- /** If keepEditViewOpenOnBlur prop is set to false, will call confirmIfUnfocused() which
120
+ /**
121
+ * If keepEditViewOpenOnBlur prop is set to false, will call confirmIfUnfocused() which
119
122
  * confirms the value, if the focus is not transferred to the action buttons.
120
123
  *
121
124
  * When you're in `editing` state, the focus will be on the input field. And if you use keyboard
@@ -137,7 +140,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
137
140
  }
138
141
  }, [keepEditViewOpenOnBlur, tryAutoSubmitWhenBlur]);
139
142
 
140
- /** Gets called when focus is transferred to the editView, or action buttons.
143
+ /**
144
+ * Gets called when focus is transferred to the editView, or action buttons.
141
145
  *
142
146
  * There are three paths here the function can be called:
143
147
  *
@@ -148,9 +152,15 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
148
152
  var onEditViewWrapperFocus = (0, _react.useCallback)(function () {
149
153
  wasFocusReceivedSinceLastBlurRef.current = true;
150
154
  }, []);
155
+ var concatenatedEditButtonLabel = function concatenatedEditButtonLabel() {
156
+ if (label) {
157
+ return "".concat(editButtonLabel, ", ").concat(label, ", ").concat(editLabel);
158
+ }
159
+ return "".concat(editButtonLabel, ", ").concat(editLabel);
160
+ };
151
161
  var renderReadView = function renderReadView() {
152
162
  return (0, _react2.jsx)(_readView.default, {
153
- editButtonLabel: editButtonLabel,
163
+ editButtonLabel: concatenatedEditButtonLabel(),
154
164
  onEditRequested: onEditRequested,
155
165
  postReadViewClick: doNotFocusOnEditButton,
156
166
  editButtonRef: editButtonRef,
@@ -209,19 +219,27 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
209
219
  cancelButtonLabel: cancelButtonLabel,
210
220
  confirmButtonLabel: confirmButtonLabel,
211
221
  onMouseDown: function onMouseDown() {
212
- /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
222
+ /**
223
+ * Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used
224
+ */
213
225
  doNotFocusOnEditButton();
214
226
  },
215
227
  onCancelClick: function onCancelClick(e) {
216
228
  reset();
217
229
  _onCancelClick(e);
218
230
  }
219
- }) : /** This is to allow Ctrl + Enter to submit without action buttons */
231
+ }) :
232
+ /**
233
+ * This is to allow Ctrl + Enter to submit without action buttons
234
+ */
220
235
  (0, _react2.jsx)(_pressable.default, {
221
236
  hidden: true,
222
237
  type: "submit"
223
238
  }, (0, _react2.jsx)(_visuallyHidden.default, null, "Submit")));
224
- }) : /** Field is used here only for the label and spacing */
239
+ }) :
240
+ /**
241
+ * Field is used here only for the label and spacing
242
+ */
225
243
  (0, _react2.jsx)(_Field.default, {
226
244
  name: "inlineEdit",
227
245
  label: label,
@@ -232,6 +250,9 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
232
250
  });
233
251
  };
234
252
  var InlineEdit = function InlineEdit(props) {
253
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
235
254
  return (0, _react2.jsx)(InnerInlineEdit, props);
236
255
  };
256
+
257
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
237
258
  var _default = exports.default = InlineEdit;
@@ -7,6 +7,7 @@ import React, { useCallback, useRef, useState } from 'react';
7
7
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
8
8
  import { css, jsx } from '@emotion/react';
9
9
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
10
+ import __noop from '@atlaskit/ds-lib/noop';
10
11
  import Field from '@atlaskit/form/Field';
11
12
  import Form from '@atlaskit/form/Form';
12
13
  import Pressable from '@atlaskit/primitives/pressable';
@@ -21,9 +22,8 @@ const fieldStyles = css({
21
22
  const analyticsAttributes = {
22
23
  componentName: 'inlineEdit',
23
24
  packageName: "@atlaskit/inline-edit",
24
- packageVersion: "13.6.1"
25
+ packageVersion: "13.7.0"
25
26
  };
26
- const noop = () => {};
27
27
  const InnerInlineEdit = props => {
28
28
  const {
29
29
  startWithEditViewOpen = false,
@@ -32,6 +32,7 @@ const InnerInlineEdit = props => {
32
32
  isRequired = false,
33
33
  readViewFitContainerWidth = false,
34
34
  editButtonLabel = 'Edit',
35
+ editLabel = 'edit',
35
36
  confirmButtonLabel = 'Confirm',
36
37
  cancelButtonLabel = 'Cancel',
37
38
  defaultValue,
@@ -42,8 +43,8 @@ const InnerInlineEdit = props => {
42
43
  editView,
43
44
  analyticsContext,
44
45
  onConfirm: providedOnConfirm,
45
- onCancel: providedOnCancel = noop,
46
- onEdit: providedOnEdit = noop,
46
+ onCancel: providedOnCancel = __noop,
47
+ onEdit: providedOnEdit = __noop,
47
48
  testId
48
49
  } = props;
49
50
  const wasFocusReceivedSinceLastBlurRef = useRef(false);
@@ -95,7 +96,8 @@ const InnerInlineEdit = props => {
95
96
  }
96
97
  }, [doNotFocusOnEditButton]);
97
98
 
98
- /** If keepEditViewOpenOnBlur prop is set to false, will call confirmIfUnfocused() which
99
+ /**
100
+ * If keepEditViewOpenOnBlur prop is set to false, will call confirmIfUnfocused() which
99
101
  * confirms the value, if the focus is not transferred to the action buttons.
100
102
  *
101
103
  * When you're in `editing` state, the focus will be on the input field. And if you use keyboard
@@ -115,7 +117,8 @@ const InnerInlineEdit = props => {
115
117
  }
116
118
  }, [keepEditViewOpenOnBlur, tryAutoSubmitWhenBlur]);
117
119
 
118
- /** Gets called when focus is transferred to the editView, or action buttons.
120
+ /**
121
+ * Gets called when focus is transferred to the editView, or action buttons.
119
122
  *
120
123
  * There are three paths here the function can be called:
121
124
  *
@@ -126,9 +129,15 @@ const InnerInlineEdit = props => {
126
129
  const onEditViewWrapperFocus = useCallback(() => {
127
130
  wasFocusReceivedSinceLastBlurRef.current = true;
128
131
  }, []);
132
+ const concatenatedEditButtonLabel = () => {
133
+ if (label) {
134
+ return `${editButtonLabel}, ${label}, ${editLabel}`;
135
+ }
136
+ return `${editButtonLabel}, ${editLabel}`;
137
+ };
129
138
  const renderReadView = () => {
130
139
  return jsx(ReadView, {
131
- editButtonLabel: editButtonLabel,
140
+ editButtonLabel: concatenatedEditButtonLabel(),
132
141
  onEditRequested: onEditRequested,
133
142
  postReadViewClick: doNotFocusOnEditButton,
134
143
  editButtonRef: editButtonRef,
@@ -187,18 +196,26 @@ const InnerInlineEdit = props => {
187
196
  cancelButtonLabel: cancelButtonLabel,
188
197
  confirmButtonLabel: confirmButtonLabel,
189
198
  onMouseDown: () => {
190
- /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
199
+ /**
200
+ * Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used
201
+ */
191
202
  doNotFocusOnEditButton();
192
203
  },
193
204
  onCancelClick: e => {
194
205
  reset();
195
206
  onCancelClick(e);
196
207
  }
197
- }) : /** This is to allow Ctrl + Enter to submit without action buttons */
208
+ }) :
209
+ /**
210
+ * This is to allow Ctrl + Enter to submit without action buttons
211
+ */
198
212
  jsx(Pressable, {
199
213
  hidden: true,
200
214
  type: "submit"
201
- }, jsx(VisuallyHidden, null, "Submit")))) : /** Field is used here only for the label and spacing */
215
+ }, jsx(VisuallyHidden, null, "Submit")))) :
216
+ /**
217
+ * Field is used here only for the label and spacing
218
+ */
202
219
  jsx(Field, {
203
220
  name: "inlineEdit",
204
221
  label: label,
@@ -208,6 +225,9 @@ const InnerInlineEdit = props => {
208
225
  }, renderReadView)));
209
226
  };
210
227
  const InlineEdit = props => {
228
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
211
229
  return jsx(InnerInlineEdit, props);
212
230
  };
231
+
232
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
213
233
  export default InlineEdit;
@@ -11,6 +11,7 @@ import React, { useCallback, useRef, useState } from 'react';
11
11
  // eslint-disable-next-line @atlaskit/ui-styling-standard/use-compiled -- Ignored via go/DSP-18766
12
12
  import { css, jsx } from '@emotion/react';
13
13
  import { usePlatformLeafEventHandler } from '@atlaskit/analytics-next';
14
+ import __noop from '@atlaskit/ds-lib/noop';
14
15
  import Field from '@atlaskit/form/Field';
15
16
  import Form from '@atlaskit/form/Form';
16
17
  import Pressable from '@atlaskit/primitives/pressable';
@@ -25,9 +26,8 @@ var fieldStyles = css({
25
26
  var analyticsAttributes = {
26
27
  componentName: 'inlineEdit',
27
28
  packageName: "@atlaskit/inline-edit",
28
- packageVersion: "13.6.1"
29
+ packageVersion: "13.7.0"
29
30
  };
30
- var noop = function noop() {};
31
31
  var InnerInlineEdit = function InnerInlineEdit(props) {
32
32
  var _props$startWithEditV = props.startWithEditViewOpen,
33
33
  startWithEditViewOpen = _props$startWithEditV === void 0 ? false : _props$startWithEditV,
@@ -41,6 +41,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
41
41
  readViewFitContainerWidth = _props$readViewFitCon === void 0 ? false : _props$readViewFitCon,
42
42
  _props$editButtonLabe = props.editButtonLabel,
43
43
  editButtonLabel = _props$editButtonLabe === void 0 ? 'Edit' : _props$editButtonLabe,
44
+ _props$editLabel = props.editLabel,
45
+ editLabel = _props$editLabel === void 0 ? 'edit' : _props$editLabel,
44
46
  _props$confirmButtonL = props.confirmButtonLabel,
45
47
  confirmButtonLabel = _props$confirmButtonL === void 0 ? 'Confirm' : _props$confirmButtonL,
46
48
  _props$cancelButtonLa = props.cancelButtonLabel,
@@ -54,9 +56,9 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
54
56
  analyticsContext = props.analyticsContext,
55
57
  providedOnConfirm = props.onConfirm,
56
58
  _props$onCancel = props.onCancel,
57
- providedOnCancel = _props$onCancel === void 0 ? noop : _props$onCancel,
59
+ providedOnCancel = _props$onCancel === void 0 ? __noop : _props$onCancel,
58
60
  _props$onEdit = props.onEdit,
59
- providedOnEdit = _props$onEdit === void 0 ? noop : _props$onEdit,
61
+ providedOnEdit = _props$onEdit === void 0 ? __noop : _props$onEdit,
60
62
  testId = props.testId;
61
63
  var wasFocusReceivedSinceLastBlurRef = useRef(false);
62
64
  var isControlled = typeof isEditing === 'undefined';
@@ -108,7 +110,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
108
110
  }
109
111
  }, [doNotFocusOnEditButton]);
110
112
 
111
- /** If keepEditViewOpenOnBlur prop is set to false, will call confirmIfUnfocused() which
113
+ /**
114
+ * If keepEditViewOpenOnBlur prop is set to false, will call confirmIfUnfocused() which
112
115
  * confirms the value, if the focus is not transferred to the action buttons.
113
116
  *
114
117
  * When you're in `editing` state, the focus will be on the input field. And if you use keyboard
@@ -130,7 +133,8 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
130
133
  }
131
134
  }, [keepEditViewOpenOnBlur, tryAutoSubmitWhenBlur]);
132
135
 
133
- /** Gets called when focus is transferred to the editView, or action buttons.
136
+ /**
137
+ * Gets called when focus is transferred to the editView, or action buttons.
134
138
  *
135
139
  * There are three paths here the function can be called:
136
140
  *
@@ -141,9 +145,15 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
141
145
  var onEditViewWrapperFocus = useCallback(function () {
142
146
  wasFocusReceivedSinceLastBlurRef.current = true;
143
147
  }, []);
148
+ var concatenatedEditButtonLabel = function concatenatedEditButtonLabel() {
149
+ if (label) {
150
+ return "".concat(editButtonLabel, ", ").concat(label, ", ").concat(editLabel);
151
+ }
152
+ return "".concat(editButtonLabel, ", ").concat(editLabel);
153
+ };
144
154
  var renderReadView = function renderReadView() {
145
155
  return jsx(ReadView, {
146
- editButtonLabel: editButtonLabel,
156
+ editButtonLabel: concatenatedEditButtonLabel(),
147
157
  onEditRequested: onEditRequested,
148
158
  postReadViewClick: doNotFocusOnEditButton,
149
159
  editButtonRef: editButtonRef,
@@ -202,19 +212,27 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
202
212
  cancelButtonLabel: cancelButtonLabel,
203
213
  confirmButtonLabel: confirmButtonLabel,
204
214
  onMouseDown: function onMouseDown() {
205
- /** Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used */
215
+ /**
216
+ * Prevents focus on edit button only if mouse is used to click button, but not when keyboard is used
217
+ */
206
218
  doNotFocusOnEditButton();
207
219
  },
208
220
  onCancelClick: function onCancelClick(e) {
209
221
  reset();
210
222
  _onCancelClick(e);
211
223
  }
212
- }) : /** This is to allow Ctrl + Enter to submit without action buttons */
224
+ }) :
225
+ /**
226
+ * This is to allow Ctrl + Enter to submit without action buttons
227
+ */
213
228
  jsx(Pressable, {
214
229
  hidden: true,
215
230
  type: "submit"
216
231
  }, jsx(VisuallyHidden, null, "Submit")));
217
- }) : /** Field is used here only for the label and spacing */
232
+ }) :
233
+ /**
234
+ * Field is used here only for the label and spacing
235
+ */
218
236
  jsx(Field, {
219
237
  name: "inlineEdit",
220
238
  label: label,
@@ -225,6 +243,9 @@ var InnerInlineEdit = function InnerInlineEdit(props) {
225
243
  });
226
244
  };
227
245
  var InlineEdit = function InlineEdit(props) {
246
+ // eslint-disable-next-line @repo/internal/react/no-unsafe-spread-props
228
247
  return jsx(InnerInlineEdit, props);
229
248
  };
249
+
250
+ // eslint-disable-next-line @repo/internal/react/require-jsdoc
230
251
  export default InlineEdit;
@@ -2,31 +2,59 @@ import { type default as React, type ReactNode } from 'react';
2
2
  import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { type FieldProps } from '@atlaskit/form';
4
4
  interface CommonProps {
5
- /** Additional information to be included in the `context` of analytics events that come from button. */
5
+ /**
6
+ * Additional information to be included in the `context` of analytics events that come from button.
7
+ */
6
8
  analyticsContext?: Record<string, any>;
7
- /** Accessibility label for the cancel action button. */
9
+ /**
10
+ * Accessibility label for the cancel action button.
11
+ */
8
12
  cancelButtonLabel?: string;
9
- /** Accessibility label for the confirm action button, which saves the field value into `editValue`. */
13
+ /**
14
+ * Accessibility label for the confirm action button, which saves the field value into `editValue`.
15
+ */
10
16
  confirmButtonLabel?: string;
11
- /** The user input entered into the field during `editView`. This value is updated and saved by `onConfirm`. */
17
+ /**
18
+ * The user input entered into the field during `editView`. This value is updated and saved by `onConfirm`.
19
+ */
12
20
  defaultValue: any;
13
- /** Label above the input field that communicates what value should be entered. */
21
+ /**
22
+ * Label above the input field that communicates what value should be entered.
23
+ */
14
24
  label?: ReactNode;
15
- /** Displays an inline dialog with a message when the field input is invalid. This is handled by `react-final-form`. */
25
+ /**
26
+ * Displays an inline dialog with a message when the field input is invalid. This is handled by `react-final-form`.
27
+ */
16
28
  validate?: (value: any, formState: {}, fieldState: {}) => string | void | Promise<string | void>;
17
29
  /**
18
30
  * Sets the view when the element blurs and loses focus (this can happen when a user clicks away).
19
- * When set to true, inline edit stays in `editView` when blurred. */
31
+ * When set to true, inline edit stays in `editView` when blurred.
32
+ */
20
33
  keepEditViewOpenOnBlur?: boolean;
21
- /** Sets whether the confirm and cancel action buttons are displayed in the bottom right of the field. */
34
+ /**
35
+ * Sets whether the confirm and cancel action buttons are displayed in the bottom right of the field.
36
+ */
22
37
  hideActionButtons?: boolean;
23
- /** Determines whether the input value can be confirmed as empty. */
38
+ /**
39
+ * Determines whether the input value can be confirmed as empty.
40
+ */
24
41
  isRequired?: boolean;
25
- /** Determines whether the `readView` has 100% width within its container, or whether it fits the content. */
42
+ /**
43
+ * Determines whether the `readView` has 100% width within its container, or whether it fits the content.
44
+ */
26
45
  readViewFitContainerWidth?: boolean;
27
- /** Accessibility label for button, which is used to enter `editView` from keyboard. */
46
+ /**
47
+ * Accessibility label for button, which is used to enter `editView` from keyboard.
48
+ */
28
49
  editButtonLabel?: string;
29
- /** Exits `editView` and switches back to `readView`. This is called when the cancel action button (x) is clicked. */
50
+ /**
51
+ * Append 'edit' to the end of the button label (`editButtonLabel`)which allows
52
+ * users of assistive technologies to understand the purpose of the button
53
+ */
54
+ editLabel?: string;
55
+ /**
56
+ * Exits `editView` and switches back to `readView`. This is called when the cancel action button (x) is clicked.
57
+ */
30
58
  onCancel?: () => void;
31
59
  /**
32
60
  * Determines whether it begins in `editView` or `readView`. When set to true, `isEditing` begins as true and the inline edit
@@ -42,30 +70,43 @@ export interface ExtendedFieldProps<FieldValue> extends FieldProps<FieldValue> {
42
70
  errorMessage?: string | undefined;
43
71
  }
44
72
  export interface InlineEditProps<FieldValue> extends CommonProps {
45
- /** The component shown when user is editing (when the inline edit is not in `readView`). */
73
+ /**
74
+ * The component shown when user is editing (when the inline edit is not in `readView`).
75
+ */
46
76
  editView: (fieldProps: ExtendedFieldProps<FieldValue>, ref: React.RefObject<any>) => React.ReactNode;
47
- /** Sets whether the component shows the `readView` or the `editView`. This is used to manage the state of the input in stateless inline edit. */
77
+ /**
78
+ * Sets whether the component shows the `readView` or the `editView`. This is used to manage the state of the input in stateless inline edit.
79
+ */
48
80
  isEditing?: boolean;
49
81
  /**
50
- Saves and confirms the value entered into the field. It exits `editView` and returns to `readView`.
51
- */
82
+ * Saves and confirms the value entered into the field. It exits `editView` and returns to `readView`.
83
+ */
52
84
  onConfirm: (value: any, analyticsEvent: UIAnalyticsEvent) => void;
53
- /** Handler called when readView is clicked. */
85
+ /**
86
+ * Handler called when readView is clicked.
87
+ */
54
88
  onEdit?: () => void;
55
- /** The component shown when not in `editView`. This is when the inline edit is read-only and not being edited.*/
89
+ /**
90
+ * The component shown when not in `editView`. This is when the inline edit is read-only and not being edited.
91
+ */
56
92
  readView: () => React.ReactNode;
57
93
  }
58
94
  export interface InlineEditableTextfieldProps extends CommonProps {
59
- /** Sets height of the text field to compact. The top and bottom padding is decreased. */
95
+ /**
96
+ * Sets height of the text field to compact. The top and bottom padding is decreased.
97
+ */
60
98
  isCompact?: boolean;
61
99
  /**
62
100
  * Calls the `editView` handler. It confirms the changes.
63
101
  * The field value is passed as an argument to this function.
64
102
  */
65
103
  onConfirm: (value: string, analyticsEvent: UIAnalyticsEvent) => void;
66
- /** Text shown in `readView` when the field value is an empty string. */
104
+ /**
105
+ * Text shown in `readView` when the field value is an empty string.
106
+ */
67
107
  placeholder: string;
68
- /** A `testId` prop is provided for specific elements. This is a unique string that appears as a data attribute `data-testid` in the rendered code and serves as a hook for automated tests.
108
+ /**
109
+ * A `testId` prop is provided for specific elements. This is a unique string that appears as a data attribute `data-testid` in the rendered code and serves as a hook for automated tests.
69
110
  */
70
111
  testId?: string;
71
112
  }
@@ -2,31 +2,59 @@ import { type default as React, type ReactNode } from 'react';
2
2
  import { type UIAnalyticsEvent } from '@atlaskit/analytics-next';
3
3
  import { type FieldProps } from '@atlaskit/form';
4
4
  interface CommonProps {
5
- /** Additional information to be included in the `context` of analytics events that come from button. */
5
+ /**
6
+ * Additional information to be included in the `context` of analytics events that come from button.
7
+ */
6
8
  analyticsContext?: Record<string, any>;
7
- /** Accessibility label for the cancel action button. */
9
+ /**
10
+ * Accessibility label for the cancel action button.
11
+ */
8
12
  cancelButtonLabel?: string;
9
- /** Accessibility label for the confirm action button, which saves the field value into `editValue`. */
13
+ /**
14
+ * Accessibility label for the confirm action button, which saves the field value into `editValue`.
15
+ */
10
16
  confirmButtonLabel?: string;
11
- /** The user input entered into the field during `editView`. This value is updated and saved by `onConfirm`. */
17
+ /**
18
+ * The user input entered into the field during `editView`. This value is updated and saved by `onConfirm`.
19
+ */
12
20
  defaultValue: any;
13
- /** Label above the input field that communicates what value should be entered. */
21
+ /**
22
+ * Label above the input field that communicates what value should be entered.
23
+ */
14
24
  label?: ReactNode;
15
- /** Displays an inline dialog with a message when the field input is invalid. This is handled by `react-final-form`. */
25
+ /**
26
+ * Displays an inline dialog with a message when the field input is invalid. This is handled by `react-final-form`.
27
+ */
16
28
  validate?: (value: any, formState: {}, fieldState: {}) => string | void | Promise<string | void>;
17
29
  /**
18
30
  * Sets the view when the element blurs and loses focus (this can happen when a user clicks away).
19
- * When set to true, inline edit stays in `editView` when blurred. */
31
+ * When set to true, inline edit stays in `editView` when blurred.
32
+ */
20
33
  keepEditViewOpenOnBlur?: boolean;
21
- /** Sets whether the confirm and cancel action buttons are displayed in the bottom right of the field. */
34
+ /**
35
+ * Sets whether the confirm and cancel action buttons are displayed in the bottom right of the field.
36
+ */
22
37
  hideActionButtons?: boolean;
23
- /** Determines whether the input value can be confirmed as empty. */
38
+ /**
39
+ * Determines whether the input value can be confirmed as empty.
40
+ */
24
41
  isRequired?: boolean;
25
- /** Determines whether the `readView` has 100% width within its container, or whether it fits the content. */
42
+ /**
43
+ * Determines whether the `readView` has 100% width within its container, or whether it fits the content.
44
+ */
26
45
  readViewFitContainerWidth?: boolean;
27
- /** Accessibility label for button, which is used to enter `editView` from keyboard. */
46
+ /**
47
+ * Accessibility label for button, which is used to enter `editView` from keyboard.
48
+ */
28
49
  editButtonLabel?: string;
29
- /** Exits `editView` and switches back to `readView`. This is called when the cancel action button (x) is clicked. */
50
+ /**
51
+ * Append 'edit' to the end of the button label (`editButtonLabel`)which allows
52
+ * users of assistive technologies to understand the purpose of the button
53
+ */
54
+ editLabel?: string;
55
+ /**
56
+ * Exits `editView` and switches back to `readView`. This is called when the cancel action button (x) is clicked.
57
+ */
30
58
  onCancel?: () => void;
31
59
  /**
32
60
  * Determines whether it begins in `editView` or `readView`. When set to true, `isEditing` begins as true and the inline edit
@@ -42,30 +70,43 @@ export interface ExtendedFieldProps<FieldValue> extends FieldProps<FieldValue> {
42
70
  errorMessage?: string | undefined;
43
71
  }
44
72
  export interface InlineEditProps<FieldValue> extends CommonProps {
45
- /** The component shown when user is editing (when the inline edit is not in `readView`). */
73
+ /**
74
+ * The component shown when user is editing (when the inline edit is not in `readView`).
75
+ */
46
76
  editView: (fieldProps: ExtendedFieldProps<FieldValue>, ref: React.RefObject<any>) => React.ReactNode;
47
- /** Sets whether the component shows the `readView` or the `editView`. This is used to manage the state of the input in stateless inline edit. */
77
+ /**
78
+ * Sets whether the component shows the `readView` or the `editView`. This is used to manage the state of the input in stateless inline edit.
79
+ */
48
80
  isEditing?: boolean;
49
81
  /**
50
- Saves and confirms the value entered into the field. It exits `editView` and returns to `readView`.
51
- */
82
+ * Saves and confirms the value entered into the field. It exits `editView` and returns to `readView`.
83
+ */
52
84
  onConfirm: (value: any, analyticsEvent: UIAnalyticsEvent) => void;
53
- /** Handler called when readView is clicked. */
85
+ /**
86
+ * Handler called when readView is clicked.
87
+ */
54
88
  onEdit?: () => void;
55
- /** The component shown when not in `editView`. This is when the inline edit is read-only and not being edited.*/
89
+ /**
90
+ * The component shown when not in `editView`. This is when the inline edit is read-only and not being edited.
91
+ */
56
92
  readView: () => React.ReactNode;
57
93
  }
58
94
  export interface InlineEditableTextfieldProps extends CommonProps {
59
- /** Sets height of the text field to compact. The top and bottom padding is decreased. */
95
+ /**
96
+ * Sets height of the text field to compact. The top and bottom padding is decreased.
97
+ */
60
98
  isCompact?: boolean;
61
99
  /**
62
100
  * Calls the `editView` handler. It confirms the changes.
63
101
  * The field value is passed as an argument to this function.
64
102
  */
65
103
  onConfirm: (value: string, analyticsEvent: UIAnalyticsEvent) => void;
66
- /** Text shown in `readView` when the field value is an empty string. */
104
+ /**
105
+ * Text shown in `readView` when the field value is an empty string.
106
+ */
67
107
  placeholder: string;
68
- /** A `testId` prop is provided for specific elements. This is a unique string that appears as a data attribute `data-testid` in the rendered code and serves as a hook for automated tests.
108
+ /**
109
+ * A `testId` prop is provided for specific elements. This is a unique string that appears as a data attribute `data-testid` in the rendered code and serves as a hook for automated tests.
69
110
  */
70
111
  testId?: string;
71
112
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atlaskit/inline-edit",
3
- "version": "13.6.1",
3
+ "version": "13.7.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/"
@@ -37,15 +37,15 @@
37
37
  },
38
38
  "dependencies": {
39
39
  "@atlaskit/analytics-next": "^10.1.0",
40
- "@atlaskit/button": "^19.2.0",
40
+ "@atlaskit/button": "^20.1.0",
41
41
  "@atlaskit/codemod-utils": "^4.2.0",
42
42
  "@atlaskit/form": "^10.5.0",
43
- "@atlaskit/icon": "^22.12.0",
43
+ "@atlaskit/icon": "^22.14.0",
44
44
  "@atlaskit/inline-dialog": "^14.3.0",
45
45
  "@atlaskit/primitives": "^12.0.0",
46
46
  "@atlaskit/textfield": "^6.5.0",
47
47
  "@atlaskit/theme": "^13.0.0",
48
- "@atlaskit/tokens": "^1.58.0",
48
+ "@atlaskit/tokens": "^1.59.0",
49
49
  "@atlaskit/visually-hidden": "^1.5.0",
50
50
  "@babel/runtime": "^7.0.0",
51
51
  "@emotion/react": "^11.7.1"
@@ -56,11 +56,11 @@
56
56
  "devDependencies": {
57
57
  "@af/accessibility-testing": "*",
58
58
  "@af/integration-testing": "*",
59
- "@atlaskit/datetime-picker": "^13.10.0",
59
+ "@atlaskit/datetime-picker": "^13.11.0",
60
60
  "@atlaskit/docs": "*",
61
- "@atlaskit/ds-lib": "^2.4.0",
61
+ "@atlaskit/ds-lib": "^2.5.0",
62
62
  "@atlaskit/section-message": "^6.6.0",
63
- "@atlaskit/select": "^17.13.0",
63
+ "@atlaskit/select": "^17.15.0",
64
64
  "@atlaskit/ssr": "*",
65
65
  "@atlaskit/tag": "^12.5.0",
66
66
  "@atlaskit/tag-group": "^10.5.0",