@atlaskit/link-datasource 3.13.17 → 3.14.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.
Files changed (56) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/cjs/hooks/useDatasourceTableFlag.js +3 -2
  3. package/dist/cjs/hooks/useLoadOptions.js +20 -9
  4. package/dist/cjs/ui/issue-like-table/edit-type/icon/index.js +4 -1
  5. package/dist/cjs/ui/issue-like-table/edit-type/index.js +9 -4
  6. package/dist/cjs/ui/issue-like-table/edit-type/status/index.js +7 -1
  7. package/dist/cjs/ui/issue-like-table/edit-type/text/index.js +3 -1
  8. package/dist/cjs/ui/issue-like-table/edit-type/user/index.js +7 -1
  9. package/dist/cjs/ui/issue-like-table/index.js +6 -2
  10. package/dist/cjs/ui/issue-like-table/table-cell-content/index.js +5 -0
  11. package/dist/cjs/ui/issue-like-table/table-cell-content/inline-edit.js +31 -2
  12. package/dist/cjs/ui/issue-like-table/table-cell-content/messages.js +14 -0
  13. package/dist/cjs/ui/issue-like-table/utils.js +21 -1
  14. package/dist/es2019/hooks/useDatasourceTableFlag.js +3 -2
  15. package/dist/es2019/hooks/useLoadOptions.js +15 -4
  16. package/dist/es2019/ui/issue-like-table/edit-type/icon/index.js +4 -1
  17. package/dist/es2019/ui/issue-like-table/edit-type/index.js +9 -4
  18. package/dist/es2019/ui/issue-like-table/edit-type/status/index.js +5 -1
  19. package/dist/es2019/ui/issue-like-table/edit-type/text/index.js +3 -1
  20. package/dist/es2019/ui/issue-like-table/edit-type/user/index.js +5 -1
  21. package/dist/es2019/ui/issue-like-table/index.js +7 -3
  22. package/dist/es2019/ui/issue-like-table/table-cell-content/index.js +5 -0
  23. package/dist/es2019/ui/issue-like-table/table-cell-content/inline-edit.js +33 -3
  24. package/dist/es2019/ui/issue-like-table/table-cell-content/messages.js +8 -0
  25. package/dist/es2019/ui/issue-like-table/utils.js +18 -1
  26. package/dist/esm/hooks/useDatasourceTableFlag.js +3 -2
  27. package/dist/esm/hooks/useLoadOptions.js +21 -10
  28. package/dist/esm/ui/issue-like-table/edit-type/icon/index.js +4 -1
  29. package/dist/esm/ui/issue-like-table/edit-type/index.js +9 -4
  30. package/dist/esm/ui/issue-like-table/edit-type/status/index.js +7 -1
  31. package/dist/esm/ui/issue-like-table/edit-type/text/index.js +3 -1
  32. package/dist/esm/ui/issue-like-table/edit-type/user/index.js +7 -1
  33. package/dist/esm/ui/issue-like-table/index.js +7 -3
  34. package/dist/esm/ui/issue-like-table/table-cell-content/index.js +5 -0
  35. package/dist/esm/ui/issue-like-table/table-cell-content/inline-edit.js +32 -3
  36. package/dist/esm/ui/issue-like-table/table-cell-content/messages.js +8 -0
  37. package/dist/esm/ui/issue-like-table/utils.js +19 -0
  38. package/dist/types/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
  39. package/dist/types/ui/issue-like-table/edit-type/index.d.ts +2 -1
  40. package/dist/types/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
  41. package/dist/types/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
  42. package/dist/types/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
  43. package/dist/types/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
  44. package/dist/types/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
  45. package/dist/types/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
  46. package/dist/types/ui/issue-like-table/utils.d.ts +20 -0
  47. package/dist/types-ts4.5/ui/issue-like-table/edit-type/icon/index.d.ts +1 -0
  48. package/dist/types-ts4.5/ui/issue-like-table/edit-type/index.d.ts +2 -1
  49. package/dist/types-ts4.5/ui/issue-like-table/edit-type/status/index.d.ts +1 -0
  50. package/dist/types-ts4.5/ui/issue-like-table/edit-type/text/index.d.ts +1 -0
  51. package/dist/types-ts4.5/ui/issue-like-table/edit-type/user/index.d.ts +1 -0
  52. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/index.d.ts +2 -1
  53. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/inline-edit.d.ts +2 -1
  54. package/dist/types-ts4.5/ui/issue-like-table/table-cell-content/messages.d.ts +7 -0
  55. package/dist/types-ts4.5/ui/issue-like-table/utils.d.ts +20 -0
  56. package/package.json +8 -8
@@ -11,6 +11,7 @@ const ACTIVE_INLINE_EDIT_ID = 'sllv-active-inline-edit';
11
11
  export const editType = ({
12
12
  defaultValue,
13
13
  currentValue,
14
+ labelId,
14
15
  setEditValues,
15
16
  executeFetch
16
17
  }) => {
@@ -24,7 +25,8 @@ export const editType = ({
24
25
  }) => /*#__PURE__*/React.createElement(TextEditType, _extends({}, fieldProps, {
25
26
  currentValue: currentValue,
26
27
  setEditValues: setEditValues,
27
- id: ACTIVE_INLINE_EDIT_ID
28
+ id: ACTIVE_INLINE_EDIT_ID,
29
+ labelId: labelId
28
30
  }))
29
31
  };
30
32
  case 'icon':
@@ -37,7 +39,8 @@ export const editType = ({
37
39
  currentValue: currentValue,
38
40
  setEditValues: setEditValues,
39
41
  id: ACTIVE_INLINE_EDIT_ID,
40
- executeFetch: executeFetch
42
+ executeFetch: executeFetch,
43
+ labelId: labelId
41
44
  }))
42
45
  };
43
46
  case 'status':
@@ -49,7 +52,8 @@ export const editType = ({
49
52
  currentValue: currentValue,
50
53
  setEditValues: setEditValues,
51
54
  id: ACTIVE_INLINE_EDIT_ID,
52
- executeFetch: executeFetch
55
+ executeFetch: executeFetch,
56
+ labelId: labelId
53
57
  }))
54
58
  };
55
59
  case 'user':
@@ -62,7 +66,8 @@ export const editType = ({
62
66
  currentValue: currentValue,
63
67
  setEditValues: setEditValues,
64
68
  id: ACTIVE_INLINE_EDIT_ID,
65
- executeFetch: executeFetch
69
+ executeFetch: executeFetch,
70
+ labelId: labelId
66
71
  }))
67
72
  };
68
73
  }
@@ -8,10 +8,12 @@ import { failUfoExperience, succeedUfoExperience } from '../../../../analytics/u
8
8
  import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
9
9
  import { useLoadOptions } from '../../../../hooks/useLoadOptions';
10
10
  import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
11
+ import { getCleanedSelectProps } from '../../utils';
11
12
  const StatusEditType = props => {
12
13
  var _currentValue$values;
13
14
  const {
14
15
  currentValue,
16
+ labelId,
15
17
  executeFetch
16
18
  } = props;
17
19
  const {
@@ -38,7 +40,7 @@ const StatusEditType = props => {
38
40
  }, [experienceId, isLoading, hasFailed]);
39
41
  return /*#__PURE__*/React.createElement(Layering, {
40
42
  isDisabled: false
41
- }, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
43
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
42
44
  autoFocus: true,
43
45
  options: options,
44
46
  defaultMenuIsOpen: true,
@@ -49,11 +51,13 @@ const StatusEditType = props => {
49
51
  testId: "inline-edit-status",
50
52
  getOptionValue: option => option.text,
51
53
  value: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
54
+ labelId: labelId,
52
55
  formatOptionLabel: option => /*#__PURE__*/React.createElement(Tooltip, {
53
56
  content: option.text
54
57
  }, /*#__PURE__*/React.createElement(Lozenge, _extends({
55
58
  testId: `inline-edit-status-option-${option.text}`
56
59
  }, option.style), option.text)),
60
+ getOptionLabel: option => option.text,
57
61
  onChange: e => props.setEditValues({
58
62
  type: 'status',
59
63
  values: e ? [e] : []
@@ -8,7 +8,8 @@ const TextEditType = props => {
8
8
  var _currentValue$values$, _currentValue$values;
9
9
  const experienceId = useDatasourceExperienceId();
10
10
  const {
11
- currentValue
11
+ currentValue,
12
+ labelId
12
13
  } = props;
13
14
  useEffect(() => {
14
15
  if (experienceId) {
@@ -28,6 +29,7 @@ const TextEditType = props => {
28
29
  padding: `${"var(--ds-space-100, 8px)"} calc(${"var(--ds-space-100, 8px)"} - 1px)`
29
30
  },
30
31
  value: (_currentValue$values$ = currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0]) !== null && _currentValue$values$ !== void 0 ? _currentValue$values$ : '',
32
+ "aria-labelledby": labelId,
31
33
  onChange: e => props.setEditValues({
32
34
  type: 'string',
33
35
  values: [e.currentTarget.value]
@@ -13,10 +13,12 @@ import { SEARCH_DEBOUNCE_MS } from '../../../common/modal/popup-select/constants
13
13
  import { USER_TYPE_TEST_ID } from '../../render-type/user';
14
14
  import { userTypeMessages } from '../../render-type/user/messages';
15
15
  import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
16
+ import { getCleanedSelectProps } from '../../utils';
16
17
  const UserEditType = props => {
17
18
  var _currentValue$values;
18
19
  const {
19
20
  currentValue,
21
+ labelId,
20
22
  executeFetch
21
23
  } = props;
22
24
  const [fetchInputs, setFetchInputs] = useState({
@@ -59,7 +61,7 @@ const UserEditType = props => {
59
61
  }, [experienceId, isLoading, hasFailed]);
60
62
  return /*#__PURE__*/React.createElement(Layering, {
61
63
  isDisabled: false
62
- }, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
64
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
63
65
  autoFocus: true,
64
66
  defaultMenuIsOpen: true,
65
67
  blurInputOnSelect: true,
@@ -70,7 +72,9 @@ const UserEditType = props => {
70
72
  menuPlacement: "auto",
71
73
  onInputChange: handleUserInputDebounced,
72
74
  value: currentValue === null || currentValue === void 0 ? void 0 : (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
75
+ labelId: labelId,
73
76
  getOptionValue: option => option.atlassianUserId,
77
+ getOptionLabel: option => option.displayName || '',
74
78
  formatOptionLabel: option => {
75
79
  var _option$displayName;
76
80
  return /*#__PURE__*/React.createElement(Tooltip, {
@@ -36,7 +36,7 @@ import { InlineEditableTableCell, Table, TableCell, TableHeading, withTablePlugi
36
36
  import { ReadOnlyCell, TableCellContent } from './table-cell-content';
37
37
  import { TruncateTextTag } from './truncate-text-tag';
38
38
  import { useIsOnScreen } from './useIsOnScreen';
39
- import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
39
+ import { COLUMN_BASE_WIDTH, getFieldLabelById, getWidthCss } from './utils';
40
40
  const tableSidePadding = "var(--ds-space-200, 16px)";
41
41
  const tableHeadStyles = css({
42
42
  background: "var(--ds-elevation-surface-current, #FFF)",
@@ -474,7 +474,8 @@ export const IssueLikeDataTableView = ({
474
474
  key: id,
475
475
  cells: visibleSortedColumns.map(({
476
476
  key,
477
- type
477
+ type,
478
+ title
478
479
  }, cellIndex) => {
479
480
  return {
480
481
  key,
@@ -484,11 +485,13 @@ export const IssueLikeDataTableView = ({
484
485
  id: id,
485
486
  columnKey: key,
486
487
  columnType: type,
488
+ columnTitle: title,
487
489
  wrappedColumnKeys: wrappedColumnKeys,
488
490
  renderItem: renderItem
489
491
  }) : jsx(ReadOnlyCell, {
490
492
  id: id,
491
493
  columnKey: key,
494
+ columnTitle: title,
492
495
  columnType: type,
493
496
  wrappedColumnKeys: wrappedColumnKeys,
494
497
  renderItem: renderItem
@@ -618,7 +621,8 @@ export const IssueLikeDataTableView = ({
618
621
  position: "bottom-start",
619
622
  testId: 'datasource-header-content'
620
623
  }, jsx("span", {
621
- css: headerStyles
624
+ css: headerStyles,
625
+ id: getFieldLabelById(key)
622
626
  }, content));
623
627
  const isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
624
628
  if (isHeadingOutsideButton) {
@@ -73,6 +73,7 @@ const InlineEditableCell = ({
73
73
  ari,
74
74
  values,
75
75
  columnKey,
76
+ columnTitle,
76
77
  renderItem,
77
78
  integrationKey,
78
79
  wrappedColumnKeys
@@ -114,6 +115,7 @@ const InlineEditableCell = ({
114
115
  executeFetch: executeFetch,
115
116
  readView: readView,
116
117
  columnKey: columnKey,
118
+ columnTitle: columnTitle,
117
119
  datasourceTypeWithValues: values
118
120
  });
119
121
  };
@@ -134,6 +136,7 @@ const toDatasourceTypeWithValues = ({
134
136
  export const TableCellContent = ({
135
137
  id,
136
138
  columnKey,
139
+ columnTitle,
137
140
  columnType,
138
141
  renderItem,
139
142
  wrappedColumnKeys
@@ -152,6 +155,7 @@ export const TableCellContent = ({
152
155
  return /*#__PURE__*/React.createElement(InlineEditableCell, {
153
156
  ari: ari,
154
157
  columnKey: columnKey,
158
+ columnTitle: columnTitle,
155
159
  renderItem: renderItem,
156
160
  integrationKey: integrationKey,
157
161
  values: toDatasourceTypeWithValues({
@@ -171,6 +175,7 @@ export const TableCellContent = ({
171
175
  }, /*#__PURE__*/React.createElement(ReadOnlyCell, {
172
176
  id: id,
173
177
  columnKey: columnKey,
178
+ columnTitle: columnTitle,
174
179
  columnType: columnType,
175
180
  wrappedColumnKeys: wrappedColumnKeys,
176
181
  renderItem: renderItem
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/extends";
2
- import React, { useCallback, useState } from 'react';
2
+ import React, { useCallback, useMemo, useState } from 'react';
3
+ import { useIntl } from 'react-intl-next';
3
4
  import AKInlineEdit from '@atlaskit/inline-edit';
4
5
  import { Box, xcss } from '@atlaskit/primitives';
5
6
  import { useSmartLinkReload } from '@atlaskit/smart-card/hooks';
@@ -10,6 +11,8 @@ import { useDatasourceTableFlag } from '../../../hooks/useDatasourceTableFlag';
10
11
  import { useDatasourceActions, useDatasourceItem } from '../../../state';
11
12
  import { editType } from '../edit-type';
12
13
  import { EmptyAvatar } from '../shared-components/avatar';
14
+ import { getFieldLabelById } from '../utils';
15
+ import { tableCellMessages } from './messages';
13
16
  export const InlineEditUFOExperience = 'inline-edit-rendered';
14
17
  const editContainerStyles = xcss({
15
18
  marginBlockStart: 'space.negative.100'
@@ -28,6 +31,21 @@ const getBackendUpdateValue = typedNewValue => {
28
31
  }
29
32
  throw new Error(`Datasource 2 way sync Backend update value not implemented for type ${typedNewValue.type}`);
30
33
  };
34
+ const getCurrentFieldLabel = typedNewValue => {
35
+ var _typedNewValue$values4, _typedNewValue$values5, _typedNewValue$values6;
36
+ switch (typedNewValue.type) {
37
+ case 'string':
38
+ return typedNewValue.values[0] || '';
39
+ case 'status':
40
+ return ((_typedNewValue$values4 = typedNewValue.values[0]) === null || _typedNewValue$values4 === void 0 ? void 0 : _typedNewValue$values4.text) || '';
41
+ case 'user':
42
+ return ((_typedNewValue$values5 = typedNewValue.values[0]) === null || _typedNewValue$values5 === void 0 ? void 0 : _typedNewValue$values5.displayName) || '';
43
+ case 'icon':
44
+ return ((_typedNewValue$values6 = typedNewValue.values[0]) === null || _typedNewValue$values6 === void 0 ? void 0 : _typedNewValue$values6.text) || '';
45
+ default:
46
+ return '';
47
+ }
48
+ };
31
49
  const mapUpdatedItem = (existingItem, columnKey, newValue) => {
32
50
  switch (newValue.type) {
33
51
  case 'string':
@@ -74,6 +92,7 @@ export const InlineEdit = ({
74
92
  executeFetch,
75
93
  readView,
76
94
  columnKey,
95
+ columnTitle,
77
96
  datasourceTypeWithValues
78
97
  }) => {
79
98
  const [isEditing, setIsEditing] = useState(false);
@@ -143,13 +162,23 @@ export const InlineEdit = ({
143
162
  });
144
163
  }
145
164
  }, [columnKey, entityType, fireEvent, integrationKey]);
165
+ const {
166
+ formatMessage
167
+ } = useIntl();
168
+ const editButtonLabel = useMemo(() => {
169
+ return formatMessage(tableCellMessages.editButtonLabel, {
170
+ fieldName: columnTitle,
171
+ fieldValue: getCurrentFieldLabel(editValues)
172
+ });
173
+ }, [columnTitle, formatMessage, editValues]);
146
174
  return /*#__PURE__*/React.createElement(Box, {
147
175
  xcss: editContainerStyles
148
176
  }, /*#__PURE__*/React.createElement(AKInlineEdit, _extends({}, editType({
149
177
  defaultValue: datasourceTypeWithValues,
150
178
  currentValue: editValues,
151
179
  setEditValues,
152
- executeFetch
180
+ executeFetch,
181
+ labelId: getFieldLabelById(columnKey)
153
182
  }), {
154
183
  hideActionButtons: true,
155
184
  readView: editableRenderType({
@@ -160,7 +189,8 @@ export const InlineEdit = ({
160
189
  isEditing: isEditing,
161
190
  onEdit: onEdit,
162
191
  onCancel: onCancelEdit,
163
- onConfirm: () => onCommitUpdate(editValues)
192
+ onConfirm: () => onCommitUpdate(editValues),
193
+ editButtonLabel: editButtonLabel
164
194
  })));
165
195
  };
166
196
 
@@ -0,0 +1,8 @@
1
+ import { defineMessages } from 'react-intl-next';
2
+ export const tableCellMessages = defineMessages({
3
+ editButtonLabel: {
4
+ id: 'linkDataSource.issue-line-table.edit-button-label.non-final',
5
+ description: 'Label of inline editable field, used mostly for screen readers. This label is used to describe the field that is editable and can be changed. e.g John Doe, Assignee field',
6
+ defaultMessage: '{fieldValue}, {fieldName} field'
7
+ }
8
+ });
@@ -53,4 +53,21 @@ export const getColumnAction = (oldVisibleColumnKeys, newVisibleColumnKeys) => {
53
53
  } else {
54
54
  return DatasourceAction.COLUMN_REORDERED;
55
55
  }
56
- };
56
+ };
57
+
58
+ /**
59
+ * Remove deprecated `aria-labelledby` prop from select component props.
60
+ */
61
+ export const getCleanedSelectProps = props => {
62
+ // Component Field auto adds `aria-labelledby` prop, which is deprecated and should not be used - https://hello.jira.atlassian.cloud/browse/ENGHEALTH-14529
63
+ const {
64
+ 'aria-labelledby': removedLabelByProps,
65
+ ...selectProps
66
+ } = props;
67
+ return selectProps;
68
+ };
69
+
70
+ /**
71
+ * Create id for table header to be used as aria-labelledby on form fields.
72
+ */
73
+ export const getFieldLabelById = fieldId => `datasource-header-title-${fieldId}`;
@@ -5,7 +5,7 @@ import React, { useCallback } from 'react';
5
5
  import { FormattedMessage } from 'react-intl-next';
6
6
  import uuid from 'uuid';
7
7
  import { useFlags } from '@atlaskit/flag';
8
- import CrossCircleIcon from '@atlaskit/icon/glyph/cross-circle';
8
+ import CrossCircleIcon from '@atlaskit/icon/core/migration/cross-circle';
9
9
  import { useDatasourceAnalyticsEvents } from '../analytics';
10
10
  import { issueLikeTableMessages } from '../ui/issue-like-table/messages';
11
11
  var getErrorReason = function getErrorReason(status) {
@@ -49,8 +49,9 @@ export var useDatasourceTableFlag = function useDatasourceTableFlag(options) {
49
49
  // We need IconTile in order to scale the new icon to 24px
50
50
  // eslint-disable-next-line @atlaskit/design-system/no-legacy-icons
51
51
  icon: /*#__PURE__*/React.createElement(CrossCircleIcon, {
52
+ spacing: "spacious",
52
53
  label: "Error",
53
- primaryColor: "var(--ds-icon-danger, #C9372C)"
54
+ color: "var(--ds-icon-danger, #C9372C)"
54
55
  }),
55
56
  id: uuid(),
56
57
  isAutoDismiss: true
@@ -1,8 +1,11 @@
1
1
  import _toConsumableArray from "@babel/runtime/helpers/toConsumableArray";
2
2
  import _slicedToArray from "@babel/runtime/helpers/slicedToArray";
3
+ import _defineProperty from "@babel/runtime/helpers/defineProperty";
3
4
  import _asyncToGenerator from "@babel/runtime/helpers/asyncToGenerator";
5
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
4
7
  import _regeneratorRuntime from "@babel/runtime/regenerator";
5
- import { useEffect, useState } from 'react';
8
+ import { useEffect, useReducer } from 'react';
6
9
  import { ActionOperationStatus } from '@atlaskit/linking-types';
7
10
  import { useDatasourceTableFlag } from './useDatasourceTableFlag';
8
11
  var loadOptions = /*#__PURE__*/function () {
@@ -46,30 +49,38 @@ var loadOptions = /*#__PURE__*/function () {
46
49
  return _ref.apply(this, arguments);
47
50
  };
48
51
  }();
52
+ var reducer = function reducer(state, payload) {
53
+ return _objectSpread(_objectSpread({}, state), payload);
54
+ };
49
55
  export var useLoadOptions = function useLoadOptions(_ref2) {
50
56
  var fetchInputs = _ref2.fetchInputs,
51
57
  executeFetch = _ref2.executeFetch,
52
58
  emptyOption = _ref2.emptyOption;
53
- var _useState = useState({
59
+ var _useReducer = useReducer(reducer, {
54
60
  isLoading: true,
55
61
  options: [],
56
62
  hasFailed: false
57
63
  }),
58
- _useState2 = _slicedToArray(_useState, 2),
59
- _useState2$ = _useState2[0],
60
- options = _useState2$.options,
61
- isLoading = _useState2$.isLoading,
62
- hasFailed = _useState2$.hasFailed,
63
- setOptions = _useState2[1];
64
+ _useReducer2 = _slicedToArray(_useReducer, 2),
65
+ _useReducer2$ = _useReducer2[0],
66
+ options = _useReducer2$.options,
67
+ isLoading = _useReducer2$.isLoading,
68
+ hasFailed = _useReducer2$.hasFailed,
69
+ dispatch = _useReducer2[1];
64
70
  var _useDatasourceTableFl = useDatasourceTableFlag({
65
71
  isFetchAction: true
66
72
  }),
67
73
  showErrorFlag = _useDatasourceTableFl.showErrorFlag;
68
74
  useEffect(function () {
69
75
  var isMounted = true;
76
+ // Set the loading state before sending the request
77
+ dispatch({
78
+ isLoading: true
79
+ });
80
+ // Query the options
70
81
  loadOptions(fetchInputs, executeFetch).then(function (options) {
71
82
  if (isMounted) {
72
- setOptions({
83
+ dispatch({
73
84
  isLoading: false,
74
85
  options: emptyOption ? [emptyOption].concat(_toConsumableArray(options)) : options,
75
86
  hasFailed: false
@@ -77,7 +88,7 @@ export var useLoadOptions = function useLoadOptions(_ref2) {
77
88
  }
78
89
  }).catch(function (err) {
79
90
  showErrorFlag();
80
- setOptions({
91
+ dispatch({
81
92
  isLoading: false,
82
93
  options: [],
83
94
  hasFailed: true
@@ -8,12 +8,14 @@ import { useDatasourceExperienceId } from '../../../../contexts/datasource-exper
8
8
  import { useLoadOptions } from '../../../../hooks/useLoadOptions';
9
9
  import { SharedIconComponent } from '../../shared-components/icon';
10
10
  import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
11
+ import { getCleanedSelectProps } from '../../utils';
11
12
  /**
12
13
  * Should be gated by FF rollout of platform-datasources-enable-two-way-sync-priority
13
14
  */
14
15
  var IconEditType = function IconEditType(props) {
15
16
  var _currentValue$values;
16
17
  var currentValue = props.currentValue,
18
+ labelId = props.labelId,
17
19
  executeFetch = props.executeFetch;
18
20
  var _useLoadOptions = useLoadOptions({
19
21
  executeFetch: executeFetch
@@ -38,7 +40,7 @@ var IconEditType = function IconEditType(props) {
38
40
  }, [experienceId, isLoading, hasFailed]);
39
41
  return /*#__PURE__*/React.createElement(Layering, {
40
42
  isDisabled: false
41
- }, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
43
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
42
44
  autoFocus: true,
43
45
  blurInputOnSelect: true,
44
46
  defaultMenuIsOpen: true,
@@ -48,6 +50,7 @@ var IconEditType = function IconEditType(props) {
48
50
  filterOption: filterOption,
49
51
  testId: "inline-edit-priority",
50
52
  value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
53
+ labelId: labelId,
51
54
  getOptionValue: function getOptionValue(option) {
52
55
  return option.text || '';
53
56
  },
@@ -16,6 +16,7 @@ export var editType = function editType(_ref) {
16
16
  var _toValueType, _value$atlassianUserI;
17
17
  var defaultValue = _ref.defaultValue,
18
18
  currentValue = _ref.currentValue,
19
+ labelId = _ref.labelId,
19
20
  setEditValues = _ref.setEditValues,
20
21
  executeFetch = _ref.executeFetch;
21
22
  switch (defaultValue.type) {
@@ -27,7 +28,8 @@ export var editType = function editType(_ref) {
27
28
  return /*#__PURE__*/React.createElement(TextEditType, _extends({}, fieldProps, {
28
29
  currentValue: currentValue,
29
30
  setEditValues: setEditValues,
30
- id: ACTIVE_INLINE_EDIT_ID
31
+ id: ACTIVE_INLINE_EDIT_ID,
32
+ labelId: labelId
31
33
  }));
32
34
  }
33
35
  };
@@ -41,7 +43,8 @@ export var editType = function editType(_ref) {
41
43
  currentValue: currentValue,
42
44
  setEditValues: setEditValues,
43
45
  id: ACTIVE_INLINE_EDIT_ID,
44
- executeFetch: executeFetch
46
+ executeFetch: executeFetch,
47
+ labelId: labelId
45
48
  }));
46
49
  }
47
50
  };
@@ -54,7 +57,8 @@ export var editType = function editType(_ref) {
54
57
  currentValue: currentValue,
55
58
  setEditValues: setEditValues,
56
59
  id: ACTIVE_INLINE_EDIT_ID,
57
- executeFetch: executeFetch
60
+ executeFetch: executeFetch,
61
+ labelId: labelId
58
62
  }));
59
63
  }
60
64
  };
@@ -68,7 +72,8 @@ export var editType = function editType(_ref) {
68
72
  currentValue: currentValue,
69
73
  setEditValues: setEditValues,
70
74
  id: ACTIVE_INLINE_EDIT_ID,
71
- executeFetch: executeFetch
75
+ executeFetch: executeFetch,
76
+ labelId: labelId
72
77
  }));
73
78
  }
74
79
  };
@@ -8,9 +8,11 @@ import { failUfoExperience, succeedUfoExperience } from '../../../../analytics/u
8
8
  import { useDatasourceExperienceId } from '../../../../contexts/datasource-experience-id';
9
9
  import { useLoadOptions } from '../../../../hooks/useLoadOptions';
10
10
  import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
11
+ import { getCleanedSelectProps } from '../../utils';
11
12
  var StatusEditType = function StatusEditType(props) {
12
13
  var _currentValue$values;
13
14
  var currentValue = props.currentValue,
15
+ labelId = props.labelId,
14
16
  executeFetch = props.executeFetch;
15
17
  var _useLoadOptions = useLoadOptions({
16
18
  executeFetch: executeFetch
@@ -35,7 +37,7 @@ var StatusEditType = function StatusEditType(props) {
35
37
  }, [experienceId, isLoading, hasFailed]);
36
38
  return /*#__PURE__*/React.createElement(Layering, {
37
39
  isDisabled: false
38
- }, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
40
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
39
41
  autoFocus: true,
40
42
  options: options,
41
43
  defaultMenuIsOpen: true,
@@ -48,6 +50,7 @@ var StatusEditType = function StatusEditType(props) {
48
50
  return option.text;
49
51
  },
50
52
  value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
53
+ labelId: labelId,
51
54
  formatOptionLabel: function formatOptionLabel(option) {
52
55
  return /*#__PURE__*/React.createElement(Tooltip, {
53
56
  content: option.text
@@ -55,6 +58,9 @@ var StatusEditType = function StatusEditType(props) {
55
58
  testId: "inline-edit-status-option-".concat(option.text)
56
59
  }, option.style), option.text));
57
60
  },
61
+ getOptionLabel: function getOptionLabel(option) {
62
+ return option.text;
63
+ },
58
64
  onChange: function onChange(e) {
59
65
  return props.setEditValues({
60
66
  type: 'status',
@@ -7,7 +7,8 @@ import { useDatasourceExperienceId } from '../../../../contexts/datasource-exper
7
7
  var TextEditType = function TextEditType(props) {
8
8
  var _currentValue$values$, _currentValue$values;
9
9
  var experienceId = useDatasourceExperienceId();
10
- var currentValue = props.currentValue;
10
+ var currentValue = props.currentValue,
11
+ labelId = props.labelId;
11
12
  useEffect(function () {
12
13
  if (experienceId) {
13
14
  succeedUfoExperience({
@@ -26,6 +27,7 @@ var TextEditType = function TextEditType(props) {
26
27
  padding: "var(--ds-space-100, 8px)".concat(" calc(", "var(--ds-space-100, 8px)", " - 1px)")
27
28
  },
28
29
  value: (_currentValue$values$ = currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0]) !== null && _currentValue$values$ !== void 0 ? _currentValue$values$ : '',
30
+ "aria-labelledby": labelId,
29
31
  onChange: function onChange(e) {
30
32
  return props.setEditValues({
31
33
  type: 'string',
@@ -14,9 +14,11 @@ import { SEARCH_DEBOUNCE_MS } from '../../../common/modal/popup-select/constants
14
14
  import { USER_TYPE_TEST_ID } from '../../render-type/user';
15
15
  import { userTypeMessages } from '../../render-type/user/messages';
16
16
  import { InlineEditUFOExperience } from '../../table-cell-content/inline-edit';
17
+ import { getCleanedSelectProps } from '../../utils';
17
18
  var UserEditType = function UserEditType(props) {
18
19
  var _currentValue$values;
19
20
  var currentValue = props.currentValue,
21
+ labelId = props.labelId,
20
22
  executeFetch = props.executeFetch;
21
23
  var _useState = useState({
22
24
  query: ''
@@ -65,7 +67,7 @@ var UserEditType = function UserEditType(props) {
65
67
  }, [experienceId, isLoading, hasFailed]);
66
68
  return /*#__PURE__*/React.createElement(Layering, {
67
69
  isDisabled: false
68
- }, /*#__PURE__*/React.createElement(Select, _extends({}, props, {
70
+ }, /*#__PURE__*/React.createElement(Select, _extends({}, getCleanedSelectProps(props), {
69
71
  autoFocus: true,
70
72
  defaultMenuIsOpen: true,
71
73
  blurInputOnSelect: true,
@@ -76,9 +78,13 @@ var UserEditType = function UserEditType(props) {
76
78
  menuPlacement: "auto",
77
79
  onInputChange: handleUserInputDebounced,
78
80
  value: currentValue === null || currentValue === void 0 || (_currentValue$values = currentValue.values) === null || _currentValue$values === void 0 ? void 0 : _currentValue$values[0],
81
+ labelId: labelId,
79
82
  getOptionValue: function getOptionValue(option) {
80
83
  return option.atlassianUserId;
81
84
  },
85
+ getOptionLabel: function getOptionLabel(option) {
86
+ return option.displayName || '';
87
+ },
82
88
  formatOptionLabel: function formatOptionLabel(option) {
83
89
  var _option$displayName;
84
90
  return /*#__PURE__*/React.createElement(Tooltip, {
@@ -43,7 +43,7 @@ import { InlineEditableTableCell, Table, TableCell, TableHeading, withTablePlugi
43
43
  import { ReadOnlyCell, TableCellContent } from './table-cell-content';
44
44
  import { TruncateTextTag } from './truncate-text-tag';
45
45
  import { useIsOnScreen } from './useIsOnScreen';
46
- import { COLUMN_BASE_WIDTH, getWidthCss } from './utils';
46
+ import { COLUMN_BASE_WIDTH, getFieldLabelById, getWidthCss } from './utils';
47
47
  var tableSidePadding = "var(--ds-space-200, 16px)";
48
48
  var tableHeadStyles = css({
49
49
  background: "var(--ds-elevation-surface-current, #FFF)",
@@ -473,7 +473,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
473
473
  key: id,
474
474
  cells: visibleSortedColumns.map(function (_ref12, cellIndex) {
475
475
  var key = _ref12.key,
476
- type = _ref12.type;
476
+ type = _ref12.type,
477
+ title = _ref12.title;
477
478
  return {
478
479
  key: key,
479
480
  columnKey: key,
@@ -482,11 +483,13 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
482
483
  id: id,
483
484
  columnKey: key,
484
485
  columnType: type,
486
+ columnTitle: title,
485
487
  wrappedColumnKeys: wrappedColumnKeys,
486
488
  renderItem: renderItem
487
489
  }) : jsx(ReadOnlyCell, {
488
490
  id: id,
489
491
  columnKey: key,
492
+ columnTitle: title,
490
493
  columnType: type,
491
494
  wrappedColumnKeys: wrappedColumnKeys,
492
495
  renderItem: renderItem
@@ -642,7 +645,8 @@ export var IssueLikeDataTableView = function IssueLikeDataTableView(_ref5) {
642
645
  position: "bottom-start",
643
646
  testId: 'datasource-header-content'
644
647
  }, jsx("span", {
645
- css: headerStyles
648
+ css: headerStyles,
649
+ id: getFieldLabelById(key)
646
650
  }, content));
647
651
  var isHeadingOutsideButton = !isEditable || !onWrappedColumnChange;
648
652
  if (isHeadingOutsideButton) {